Browse Source

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>
v7.x
Michaël Zasso 8 years ago
committed by Myles Borins
parent
commit
33bcd6fec8
  1. 2
      deps/v8/include/v8-version.h
  2. 1
      deps/v8/src/bailout-reason.h
  3. 7
      deps/v8/src/code-stubs.h
  4. 10
      deps/v8/src/compiler/js-generic-lowering.cc
  5. 9
      deps/v8/src/compiler/js-global-object-specialization.cc
  6. 2
      deps/v8/src/compiler/simplified-lowering.cc
  7. 2
      deps/v8/src/compiler/typer.cc
  8. 16
      deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc
  9. 15
      deps/v8/src/crankshaft/arm64/lithium-codegen-arm64.cc
  10. 16
      deps/v8/src/crankshaft/hydrogen.cc
  11. 17
      deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc
  12. 16
      deps/v8/src/crankshaft/mips/lithium-codegen-mips.cc
  13. 16
      deps/v8/src/crankshaft/mips64/lithium-codegen-mips64.cc
  14. 16
      deps/v8/src/crankshaft/ppc/lithium-codegen-ppc.cc
  15. 16
      deps/v8/src/crankshaft/s390/lithium-codegen-s390.cc
  16. 15
      deps/v8/src/crankshaft/x64/lithium-codegen-x64.cc
  17. 17
      deps/v8/src/crankshaft/x87/lithium-codegen-x87.cc
  18. 16
      deps/v8/src/full-codegen/arm/full-codegen-arm.cc
  19. 15
      deps/v8/src/full-codegen/arm64/full-codegen-arm64.cc
  20. 17
      deps/v8/src/full-codegen/ia32/full-codegen-ia32.cc
  21. 16
      deps/v8/src/full-codegen/mips/full-codegen-mips.cc
  22. 16
      deps/v8/src/full-codegen/mips64/full-codegen-mips64.cc
  23. 16
      deps/v8/src/full-codegen/ppc/full-codegen-ppc.cc
  24. 16
      deps/v8/src/full-codegen/s390/full-codegen-s390.cc
  25. 15
      deps/v8/src/full-codegen/x64/full-codegen-x64.cc
  26. 17
      deps/v8/src/full-codegen/x87/full-codegen-x87.cc
  27. 7
      deps/v8/src/interpreter/bytecode-generator.cc
  28. 8
      deps/v8/src/runtime/runtime-utils.h
  29. 4
      deps/v8/src/type-cache.h
  30. 51
      deps/v8/test/mjsunit/compiler/math-sign.js
  31. 30
      deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js
  32. 31
      deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js

2
deps/v8/include/v8-version.h

@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5 #define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 4 #define V8_MINOR_VERSION 4
#define V8_BUILD_NUMBER 500 #define V8_BUILD_NUMBER 500
#define V8_PATCH_LEVEL 36 #define V8_PATCH_LEVEL 41
// Use 1 for candidates and 0 otherwise. // Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.) // (Boolean macro values are not supported by all preprocessors.)

1
deps/v8/src/bailout-reason.h

@ -257,6 +257,7 @@ namespace internal {
V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
V(kUnsupportedSwitchStatement, "Unsupported switch statement") \ V(kUnsupportedSwitchStatement, "Unsupported switch statement") \
V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \ V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \
V(kUnstableConstantTypeHeapObject, "Unstable constant-type heap object") \
V(kVariableResolvedToWithContext, "Variable resolved to with context") \ V(kVariableResolvedToWithContext, "Variable resolved to with context") \
V(kWeShouldNotHaveAnEmptyLexicalContext, \ V(kWeShouldNotHaveAnEmptyLexicalContext, \
"We should not have an empty lexical context") \ "We should not have an empty lexical context") \

7
deps/v8/src/code-stubs.h

@ -1160,6 +1160,8 @@ class FastNewClosureStub : public TurboFanCodeStub {
class FastNewFunctionContextStub final : public TurboFanCodeStub { class FastNewFunctionContextStub final : public TurboFanCodeStub {
public: public:
static const int kMaximumSlots = 0x8000;
explicit FastNewFunctionContextStub(Isolate* isolate) explicit FastNewFunctionContextStub(Isolate* isolate)
: TurboFanCodeStub(isolate) {} : TurboFanCodeStub(isolate) {}
@ -1169,6 +1171,11 @@ class FastNewFunctionContextStub final : public TurboFanCodeStub {
compiler::Node* context); compiler::Node* context);
private: 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_CALL_INTERFACE_DESCRIPTOR(FastNewFunctionContext);
DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub); DEFINE_TURBOFAN_CODE_STUB(FastNewFunctionContext, TurboFanCodeStub);
}; };

10
deps/v8/src/compiler/js-generic-lowering.cc

@ -444,9 +444,13 @@ void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
int const slot_count = OpParameter<int>(node->op()); int const slot_count = OpParameter<int>(node->op());
CallDescriptor::Flags flags = FrameStateFlagForCall(node); CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable = CodeFactory::FastNewFunctionContext(isolate()); if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) {
node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count)); Callable callable = CodeFactory::FastNewFunctionContext(isolate());
ReplaceWithStubCall(node, callable, flags); node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count));
ReplaceWithStubCall(node, callable, flags);
} else {
ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext);
}
} }

9
deps/v8/src/compiler/js-global-object-specialization.cc

@ -181,13 +181,18 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
dependencies()->AssumePropertyCell(property_cell); dependencies()->AssumePropertyCell(property_cell);
Type* property_cell_value_type; Type* property_cell_value_type;
if (property_cell_value->IsHeapObject()) { 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. // Check that the {value} is a HeapObject.
value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(),
value, effect, control); value, effect, control);
// Check {value} map agains the {property_cell} map. // 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( effect = graph()->NewNode(
simplified()->CheckMaps(1), value, simplified()->CheckMaps(1), value,
jsgraph()->HeapConstant(property_cell_value_map), effect, control); jsgraph()->HeapConstant(property_cell_value_map), effect, control);

2
deps/v8/src/compiler/simplified-lowering.cc

@ -2977,7 +2977,7 @@ Node* SimplifiedLowering::Float64Sign(Node* const node) {
graph()->NewNode( graph()->NewNode(
common()->Select(MachineRepresentation::kFloat64), common()->Select(MachineRepresentation::kFloat64),
graph()->NewNode(machine()->Float64LessThan(), zero, input), one, graph()->NewNode(machine()->Float64LessThan(), zero, input), one,
zero)); input));
} }
Node* SimplifiedLowering::Int32Abs(Node* const node) { Node* SimplifiedLowering::Int32Abs(Node* const node) {

2
deps/v8/src/compiler/typer.cc

@ -1321,7 +1321,7 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
case kMathTan: case kMathTan:
return Type::Number(); return Type::Number();
case kMathSign: case kMathSign:
return t->cache_.kMinusOneToOne; return t->cache_.kMinusOneToOneOrMinusZeroOrNaN;
// Binary math functions. // Binary math functions.
case kMathAtan2: case kMathAtan2:
case kMathPow: case kMathPow:

16
deps/v8/src/crankshaft/arm/lithium-codegen-arm.cc

@ -164,11 +164,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

15
deps/v8/src/crankshaft/arm64/lithium-codegen-arm64.cc

@ -595,11 +595,16 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(x1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);
// Context is returned in x0. It replaces the context passed to us. It's // Context is returned in x0. It replaces the context passed to us. It's

16
deps/v8/src/crankshaft/hydrogen.cc

@ -6899,11 +6899,19 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
access = access.WithRepresentation(Representation::Smi()); access = access.WithRepresentation(Representation::Smi());
break; break;
case PropertyCellConstantType::kStableMap: { case PropertyCellConstantType::kStableMap: {
// The map may no longer be stable, deopt if it's ever different from // First check that the previous value of the {cell} still has the
// what is currently there, which will allow for restablization. // map that we are about to check the new {value} for. If not, then
Handle<Map> map(HeapObject::cast(cell->value())->map()); // 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); Add<HCheckHeapObject>(value);
value = Add<HCheckMaps>(value, map); value = Add<HCheckMaps>(value, cell_value_map);
access = access.WithRepresentation(Representation::HeapObject()); access = access.WithRepresentation(Representation::HeapObject());
break; break;
} }

17
deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc

@ -176,12 +176,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), FastNewFunctionContextStub stub(isolate());
Immediate(slots)); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
__ CallStub(&stub); Immediate(slots));
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

16
deps/v8/src/crankshaft/mips/lithium-codegen-mips.cc

@ -183,11 +183,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ li(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

16
deps/v8/src/crankshaft/mips64/lithium-codegen-mips64.cc

@ -159,11 +159,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ li(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(a1);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

16
deps/v8/src/crankshaft/ppc/lithium-codegen-ppc.cc

@ -170,11 +170,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r4);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

16
deps/v8/src/crankshaft/s390/lithium-codegen-s390.cc

@ -160,11 +160,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(r3);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

15
deps/v8/src/crankshaft/x64/lithium-codegen-x64.cc

@ -179,11 +179,16 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ Push(rdi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

17
deps/v8/src/crankshaft/x87/lithium-codegen-x87.cc

@ -146,12 +146,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext); __ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt; deopt_mode = Safepoint::kLazyDeopt;
} else { } else {
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), FastNewFunctionContextStub stub(isolate());
Immediate(slots)); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
__ CallStub(&stub); Immediate(slots));
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // Result of FastNewFunctionContextStub is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ CallRuntime(Runtime::kNewFunctionContext);
}
} }
RecordSafepoint(deopt_mode); RecordSafepoint(deopt_mode);

16
deps/v8/src/full-codegen/arm/full-codegen-arm.cc

@ -184,11 +184,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(r3); // Preserve new target. __ push(r3); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(r3); // Preserve new target. __ pop(r3); // Preserve new target.
} }

15
deps/v8/src/full-codegen/arm64/full-codegen-arm64.cc

@ -187,11 +187,16 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ Push(x3); // Preserve new target. __ Push(x3); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ Mov(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // 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) { if (info->scope()->new_target_var() != nullptr) {
__ Pop(x3); // Restore new target. __ Pop(x3); // Restore new target.
} }

17
deps/v8/src/full-codegen/ia32/full-codegen-ia32.cc

@ -176,12 +176,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(edx); // Preserve new target. __ push(edx); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), FastNewFunctionContextStub stub(isolate());
Immediate(slots)); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
__ CallStub(&stub); Immediate(slots));
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(edx); // Restore new target. __ pop(edx); // Restore new target.
} }

16
deps/v8/src/full-codegen/mips/full-codegen-mips.cc

@ -194,11 +194,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(a3); // Preserve new target. __ push(a3); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ li(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(a3); // Restore new target. __ pop(a3); // Restore new target.
} }

16
deps/v8/src/full-codegen/mips64/full-codegen-mips64.cc

@ -193,11 +193,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(a3); // Preserve new target. __ push(a3); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ li(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(a3); // Restore new target. __ pop(a3); // Restore new target.
} }

16
deps/v8/src/full-codegen/ppc/full-codegen-ppc.cc

@ -190,11 +190,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(r6); // Preserve new target. __ push(r6); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(r6); // Preserve new target. __ pop(r6); // Preserve new target.
} }

16
deps/v8/src/full-codegen/s390/full-codegen-s390.cc

@ -195,11 +195,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(r5); // Preserve new target. __ push(r5); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
// Result of FastNewFunctionContextStub is always in new space. Operand(slots));
need_write_barrier = false; __ 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(r5); // Preserve new target. __ pop(r5); // Preserve new target.
} }

15
deps/v8/src/full-codegen/x64/full-codegen-x64.cc

@ -175,11 +175,16 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ Push(rdx); // Preserve new target. __ Push(rdx); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); FastNewFunctionContextStub stub(isolate());
__ CallStub(&stub); __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots);
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // 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) { if (info->scope()->new_target_var() != nullptr) {
__ Pop(rdx); // Restore new target. __ Pop(rdx); // Restore new target.
} }

17
deps/v8/src/full-codegen/x87/full-codegen-x87.cc

@ -176,12 +176,17 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) { if (info->scope()->new_target_var() != nullptr) {
__ push(edx); // Preserve new target. __ push(edx); // Preserve new target.
} }
FastNewFunctionContextStub stub(isolate()); if (slots <= FastNewFunctionContextStub::kMaximumSlots) {
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(), FastNewFunctionContextStub stub(isolate());
Immediate(slots)); __ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
__ CallStub(&stub); Immediate(slots));
// Result of FastNewFunctionContextStub is always in new space. __ CallStub(&stub);
need_write_barrier = false; // 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) { if (info->scope()->new_target_var() != nullptr) {
__ pop(edx); // Restore new target. __ pop(edx); // Restore new target.
} }

7
deps/v8/src/interpreter/bytecode-generator.cc

@ -3168,7 +3168,12 @@ void BytecodeGenerator::VisitNewLocalFunctionContext() {
.CallRuntime(Runtime::kNewScriptContext, closure, 2); .CallRuntime(Runtime::kNewScriptContext, closure, 2);
} else { } else {
int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 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(); execution_result()->SetResultInAccumulator();
} }

8
deps/v8/src/runtime/runtime-utils.h

@ -69,9 +69,11 @@ namespace internal {
// Assert that the given argument has a valid value for a LanguageMode // Assert that the given argument has a valid value for a LanguageMode
// and store it in a LanguageMode variable with the given name. // and store it in a LanguageMode variable with the given name.
#define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \ #define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \
CHECK(args[index]->IsSmi()); \ CHECK(args[index]->IsNumber()); \
CHECK(is_valid_language_mode(args.smi_at(index))); \ int32_t __tmp_##name = 0; \
LanguageMode name = static_cast<LanguageMode>(args.smi_at(index)); 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 // 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. // and convert it to int32_t. If the argument is not an Int32 we crash safely.

4
deps/v8/src/type-cache.h

@ -50,7 +50,9 @@ class TypeCache final {
Type* const kTenOrUndefined = Type* const kTenOrUndefined =
Type::Union(kSingletonTen, Type::Undefined(), zone()); Type::Union(kSingletonTen, Type::Undefined(), zone());
Type* const kMinusOneOrZero = CreateRange(-1.0, 0.0); 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 kZeroOrOne = CreateRange(0.0, 1.0);
Type* const kZeroOrOneOrNaN = Type::Union(kZeroOrOne, Type::NaN(), zone()); Type* const kZeroOrOneOrNaN = Type::Union(kZeroOrOne, Type::NaN(), zone());
Type* const kZeroToThirtyOne = CreateRange(0.0, 31.0); Type* const kZeroToThirtyOne = CreateRange(0.0, 31.0);

51
deps/v8/test/mjsunit/compiler/math-sign.js

@ -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
deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js

@ -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
deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js

@ -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');
Loading…
Cancel
Save