Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 2249cbc..22299de 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -882,7 +882,9 @@
Handle<FixedArray> constant_properties = Handle<FixedArray>::cast(
bytecode_iterator().GetConstantForIndexOperand(0));
int literal_index = bytecode_iterator().GetIndexOperand(1);
- int literal_flags = bytecode_iterator().GetFlagOperand(2);
+ int bytecode_flags = bytecode_iterator().GetFlagOperand(2);
+ int literal_flags =
+ interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags);
// TODO(mstarzinger): Thread through number of properties.
int number_of_properties = constant_properties->length() / 2;
const Operator* op = javascript()->CreateLiteralObject(
@@ -1121,9 +1123,11 @@
void BytecodeGraphBuilder::VisitInc() {
FrameStateBeforeAndAfter states(this);
- const Operator* js_op = javascript()->Add(BinaryOperationHints::Any());
+ // Note: Use subtract -1 here instead of add 1 to ensure we always convert to
+ // a number, not a string.
+ const Operator* js_op = javascript()->Subtract(BinaryOperationHints::Any());
Node* node = NewNode(js_op, environment()->LookupAccumulator(),
- jsgraph()->OneConstant());
+ jsgraph()->Constant(-1.0));
environment()->BindAccumulator(node, &states);
}
@@ -1136,6 +1140,13 @@
}
void BytecodeGraphBuilder::VisitLogicalNot() {
+ Node* value = environment()->LookupAccumulator();
+ Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value,
+ jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
+ environment()->BindAccumulator(node);
+}
+
+void BytecodeGraphBuilder::VisitToBooleanLogicalNot() {
Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny),
environment()->LookupAccumulator());
Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value,
@@ -1209,7 +1220,6 @@
}
void BytecodeGraphBuilder::VisitTestInstanceOf() {
- DCHECK(!FLAG_harmony_instanceof);
BuildCompareOp(javascript()->InstanceOf());
}
@@ -1362,6 +1372,48 @@
environment()->BindAccumulator(index, &states);
}
+void BytecodeGraphBuilder::VisitSuspendGenerator() {
+ Node* state = environment()->LookupAccumulator();
+ Node* generator = environment()->LookupRegister(
+ bytecode_iterator().GetRegisterOperand(0));
+
+ for (int i = 0; i < environment()->register_count(); ++i) {
+ Node* value = environment()->LookupRegister(interpreter::Register(i));
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorStoreRegister),
+ generator, jsgraph()->Constant(i), value);
+ }
+
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContext), generator);
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation),
+ generator, state);
+}
+
+void BytecodeGraphBuilder::VisitResumeGenerator() {
+ FrameStateBeforeAndAfter states(this);
+
+ Node* generator = environment()->LookupRegister(
+ bytecode_iterator().GetRegisterOperand(0));
+ Node* state = NewNode(javascript()->CallRuntime(
+ Runtime::kGeneratorGetContinuation), generator);
+
+ // Bijection between registers and array indices must match that used in
+ // InterpreterAssembler::ExportRegisterFile.
+ for (int i = 0; i < environment()->register_count(); ++i) {
+ Node* value = NewNode(
+ javascript()->CallRuntime(Runtime::kGeneratorLoadRegister),
+ generator, jsgraph()->Constant(i));
+ environment()->BindRegister(interpreter::Register(i), value);
+
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorStoreRegister),
+ generator, jsgraph()->Constant(i), jsgraph()->StaleRegisterConstant());
+ }
+
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation),
+ generator, jsgraph()->Constant(JSGeneratorObject::kGeneratorExecuting));
+
+ environment()->BindAccumulator(state, &states);
+}
+
void BytecodeGraphBuilder::VisitWide() {
// Consumed by the BytecodeArrayIterator.
UNREACHABLE();
@@ -1373,10 +1425,12 @@
}
void BytecodeGraphBuilder::VisitIllegal() {
- // Never present in valid bytecode.
+ // Not emitted in valid bytecode.
UNREACHABLE();
}
+void BytecodeGraphBuilder::VisitNop() {}
+
void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) {
if (merge_environments_[current_offset] != nullptr) {
if (environment() != nullptr) {