deps: update V8 to 5.4.500.41

PR-URL: https://github.com/nodejs/node/pull/9412
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
Michaël Zasso authored and Myles Borins committed 2016-11-11 10:49:21 -05:00
1 parent 45df0ee717
commit 33bcd6fec8
32 files changed
+357 -111

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 4
#define V8_BUILD_NUMBER 500
#define V8_PATCH_LEVEL 36
#define V8_PATCH_LEVEL 41
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
+1
View File
@@ -257,6 +257,7 @@ namespace internal {
V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
V(kUnsupportedSwitchStatement, "Unsupported switch statement") \
V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \
V(kUnstableConstantTypeHeapObject, "Unstable constant-type heap object") \
V(kVariableResolvedToWithContext, "Variable resolved to with context") \
V(kWeShouldNotHaveAnEmptyLexicalContext, \
"We should not have an empty lexical context") \
+7
View File
@@ -1160,6 +1160,8 @@ class FastNewClosureStub : public TurboFanCodeStub {
class FastNewFunctionContextStub final : public TurboFanCodeStub {
public:
static const int kMaximumSlots = 0x8000;
explicit FastNewFunctionContextStub(Isolate* isolate)
: TurboFanCodeStub(isolate) {}
@@ -1169,6 +1171,11 @@ class FastNewFunctionContextStub final : public TurboFanCodeStub {
compiler::Node* context);
private:
// FastNewFunctionContextStub can only allocate closures which fit in the
// new space.
STATIC_ASSERT(((kMaximumSlots + Context::MIN_CONTEXT_SLOTS) * kPointerSize +
FixedArray::kHeaderSize) < Page::kMaxRegularHeapObjectSize);
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext);
DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub);
};
+7 -3
View File
@@ -444,9 +444,13 @@ void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
int const slot_count = OpParameter<int>(node->op());
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable = CodeFactory::FastNewFunctionContext(isolate());
node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count));
ReplaceWithStubCall(node, callable, flags);
if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) {
Callable callable = CodeFactory::FastNewFunctionContext(isolate());
node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count));
ReplaceWithStubCall(node, callable, flags);
} else {
ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext);
}
}
+7 -2
View File
@@ -181,13 +181,18 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
dependencies()->AssumePropertyCell(property_cell);
Type* property_cell_value_type;
if (property_cell_value->IsHeapObject()) {
// We cannot do anything if the {property_cell_value}s map is no
// longer stable.
Handle<Map> property_cell_value_map(
Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
if (!property_cell_value_map->is_stable()) return NoChange();
dependencies()->AssumeMapStable(property_cell_value_map);
// Check that the {value} is a HeapObject.
value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(),
value, effect, control);
// Check {value} map agains the {property_cell} map.
Handle<Map> property_cell_value_map(
Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
effect = graph()->NewNode(
simplified()->CheckMaps(1), value,
jsgraph()->HeapConstant(property_cell_value_map), effect, control);
+1 -1
View File
@@ -2977,7 +2977,7 @@ Node* SimplifiedLowering::Float64Sign(Node* const node) {
graph()->NewNode(
common()->Select(MachineRepresentation::kFloat64),
graph()->NewNode(machine()->Float64LessThan(), zero, input), one,
zero));
input));
}
Node* SimplifiedLowering::Int32Abs(Node* const node) {
+1 -1
View File
@@ -1321,7 +1321,7 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
case kMathTan:
return Type::Number();
case kMathSign:
return t->cache_.kMinusOneToOne;
return t->cache_.kMinusOneToOneOrMinusZeroOrNaN;
// Binary math functions.
case kMathAtan2:
case kMathPow:
+11 -5
View File
@@ -164,11 +164,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+10 -5
View File
@@ -595,11 +595,16 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(x1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
// Context is returned in x0. It replaces the context passed to us. It's
+12 -4
View File
@@ -6899,11 +6899,19 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
access = access.WithRepresentation(Representation::Smi());
break;
case PropertyCellConstantType::kStableMap: {
// The map may no longer be stable, deopt if it's ever different from
// what is currently there, which will allow for restablization.
Handle<Map> map(HeapObject::cast(cell->value())->map());
// First check that the previous value of the {cell} still has the
// map that we are about to check the new {value} for. If not, then
// the stable map assumption was invalidated and we cannot continue
// with the optimized code.
Handle<HeapObject> cell_value(HeapObject::cast(cell->value()));
Handle<Map> cell_value_map(cell_value->map());
if (!cell_value_map->is_stable()) {
return Bailout(kUnstableConstantTypeHeapObject);
}
top_info()->dependencies()->AssumeMapStable(cell_value_map);
// Now check that the new {value} is a HeapObject with the same map.
Add<HCheckHeapObject>(value);
value = Add<HCheckMaps>(value, map);
value = Add<HCheckMaps>(value, cell_value_map);
access = access.WithRepresentation(Representation::HeapObject());
break;
}
+11 -6
View File
@@ -176,12 +176,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -5
View File
@@ -183,11 +183,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -5
View File
@@ -159,11 +159,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -5
View File
@@ -170,11 +170,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r4);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -5
View File
@@ -160,11 +160,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r3);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+10 -5
View File
@@ -179,11 +179,16 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(rdi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -6
View File
@@ -146,12 +146,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
}
RecordSafepoint(deopt_mode);
+11 -5
View File
@@ -184,11 +184,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(r3); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(r3); // Preserve new target.
}
+10 -5
View File
@@ -187,11 +187,16 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ Push(x3); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(x1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ Pop(x3); // Restore new target.
}
+11 -6
View File
@@ -176,12 +176,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(edx); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(edx); // Restore new target.
}
+11 -5
View File
@@ -194,11 +194,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(a3); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(a3); // Restore new target.
}
+11 -5
View File
@@ -193,11 +193,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(a3); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ li(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(a3); // Restore new target.
}
+11 -5
View File
@@ -190,11 +190,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(r6); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r4);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(r6); // Preserve new target.
}
+11 -5
View File
@@ -195,11 +195,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(r5); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Operand(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r3);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(r5); // Preserve new target.
}
+10 -5
View File
@@ -175,11 +175,16 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ Push(rdx); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(rdi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ Pop(rdx); // Restore new target.
}
+11 -6
View File
@@ -176,12 +176,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(edx); // Preserve new target.
}
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
FastNewFunctionContextStub stub(isolate());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
if (info->scope()->new_target_var() != nullptr) {
__ pop(edx); // Restore new target.
}
+6 -1
View File
@@ -3168,7 +3168,12 @@ void BytecodeGenerator::VisitNewLocalFunctionContext() {
.CallRuntime(Runtime::kNewScriptContext, closure, 2);
} else {
int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
builder()->CreateFunctionContext(slot_count);
if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) {
builder()->CreateFunctionContext(slot_count);
} else {
builder()->CallRuntime(Runtime::kNewFunctionContext,
Register::function_closure(), 1);
}
}
execution_result()->SetResultInAccumulator();
}
+5 -3
View File
@@ -69,9 +69,11 @@ namespace internal {
// Assert that the given argument has a valid value for a LanguageMode
// and store it in a LanguageMode variable with the given name.
#define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \
CHECK(args[index]->IsSmi()); \
CHECK(is_valid_language_mode(args.smi_at(index))); \
LanguageMode name = static_cast<LanguageMode>(args.smi_at(index));
CHECK(args[index]->IsNumber()); \
int32_t __tmp_##name = 0; \
CHECK(args[index]->ToInt32(&__tmp_##name)); \
CHECK(is_valid_language_mode(__tmp_##name)); \
LanguageMode name = static_cast<LanguageMode>(__tmp_##name);
// Assert that the given argument is a number within the Int32 range
// and convert it to int32_t. If the argument is not an Int32 we crash safely.
+3 -1
View File
@@ -50,7 +50,9 @@ class TypeCache final {
Type* const kTenOrUndefined =
Type::Union(kSingletonTen, Type::Undefined(), zone());
Type* const kMinusOneOrZero = CreateRange(-1.0, 0.0);
Type* const kMinusOneToOne = CreateRange(-1.0, 1.0);
Type* const kMinusOneToOneOrMinusZeroOrNaN = Type::Union(
Type::Union(CreateRange(-1.0, 1.0), Type::MinusZero(), zone()),
Type::NaN(), zone());
Type* const kZeroOrOne = CreateRange(0.0, 1.0);
Type* const kZeroOrOneOrNaN = Type::Union(kZeroOrOne, Type::NaN(), zone());
Type* const kZeroToThirtyOne = CreateRange(0.0, 31.0);
+51
View File
@@ -0,0 +1,51 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function signInt32(i) {
i = i|0;
return Math.sign(i);
}
signInt32(0);
signInt32(2);
%OptimizeFunctionOnNextCall(signInt32);
assertEquals(1, signInt32(1));
assertEquals(0, signInt32(0));
assertEquals(-1, signInt32(-1));
assertEquals(-1, signInt32(-1));
assertEquals(1, signInt32(2147483647));
assertEquals(-1, signInt32(2147483648));
assertEquals(-1, signInt32(-2147483648));
assertEquals(0, signInt32(NaN));
assertEquals(0, signInt32(undefined));
assertEquals(0, signInt32(-0));
function signFloat64(i) {
return Math.sign(+i);
}
signFloat64(0.1);
signFloat64(-0.1);
%OptimizeFunctionOnNextCall(signFloat64);
assertEquals(1, signFloat64(1));
assertEquals(1, signFloat64(0.001));
assertEquals(-1, signFloat64(-0.002));
assertEquals(1, signFloat64(1e100));
assertEquals(-1, signFloat64(-2e100));
assertEquals(0, signFloat64(0));
assertEquals(Infinity, 1/signFloat64(0));
assertEquals(-1, signFloat64(-1));
assertEquals(-1, signFloat64(-1));
assertEquals(1, signFloat64(2147483647));
assertEquals(1, signFloat64(2147483648));
assertEquals(-1, signFloat64(-2147483647));
assertEquals(-1, signFloat64(-2147483648));
assertEquals(-1, signFloat64(-2147483649));
assertEquals(-0, signFloat64(-0));
assertEquals(NaN, signFloat64(NaN));
assertEquals(NaN, signFloat64(undefined));
assertEquals(1, signFloat64(Infinity));
assertEquals(-1, signFloat64(-Infinity));
+30
View File
@@ -0,0 +1,30 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
var n;
function Ctor() {
n = new Set();
}
function Check() {
n.xyz = 0x826852f4;
}
Ctor();
Ctor();
%OptimizeFunctionOnNextCall(Ctor);
Ctor();
Check();
Check();
%OptimizeFunctionOnNextCall(Check);
Check();
Ctor();
Check();
parseInt('AAAAAAAA');
+31
View File
@@ -0,0 +1,31 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
var n;
function Ctor() {
try { } catch (e) {}
n = new Set();
}
function Check() {
n.xyz = 0x826852f4;
}
Ctor();
Ctor();
%OptimizeFunctionOnNextCall(Ctor);
Ctor();
Check();
Check();
%OptimizeFunctionOnNextCall(Check);
Check();
Ctor();
Check();
parseInt('AAAAAAAA');