Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc
index 926cd3c..dab0621 100644
--- a/src/runtime/runtime-generator.cc
+++ b/src/runtime/runtime-generator.cc
@@ -22,11 +22,8 @@
RUNTIME_ASSERT(function->shared()->is_generator());
Handle<JSGeneratorObject> generator;
- if (frame->IsConstructor()) {
- generator = handle(JSGeneratorObject::cast(frame->receiver()));
- } else {
- generator = isolate->factory()->NewJSGeneratorObject(function);
- }
+ DCHECK(!frame->IsConstructor());
+ generator = isolate->factory()->NewJSGeneratorObject(function);
generator->set_function(*function);
generator->set_context(Context::cast(frame->context()));
generator->set_receiver(frame->receiver());
@@ -39,7 +36,7 @@
RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) {
HandleScope handle_scope(isolate);
- DCHECK(args.length() == 1 || args.length() == 2);
+ DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0);
JavaScriptFrameIterator stack_iterator(isolate);
@@ -58,18 +55,6 @@
DCHECK_GE(operands_count, 1 + args.length());
operands_count -= 1 + args.length();
- // Second argument indicates that we need to patch the handler table because
- // a delegating yield introduced a try-catch statement at expression level,
- // hence the operand count was off when we statically computed it.
- // TODO(mstarzinger): This special case disappears with do-expressions.
- if (args.length() == 2) {
- CONVERT_SMI_ARG_CHECKED(handler_index, 1);
- Handle<Code> code(frame->unchecked_code());
- Handle<HandlerTable> table(HandlerTable::cast(code->handler_table()));
- int handler_depth = operands_count - TryBlockConstant::kElementCount;
- table->SetRangeDepth(handler_index, handler_depth);
- }
-
if (operands_count == 0) {
// Although it's semantically harmless to call this function with an
// operands_count of zero, it is also unnecessary.
@@ -90,9 +75,9 @@
// called if the suspended activation had operands on the stack, stack handlers
// needing rewinding, or if the resume should throw an exception. The fast path
// is handled directly in FullCodeGenerator::EmitGeneratorResume(), which is
-// inlined into GeneratorNext and GeneratorThrow. EmitGeneratorResumeResume is
-// called in any case, as it needs to reconstruct the stack frame and make space
-// for arguments and operands.
+// inlined into GeneratorNext, GeneratorReturn, and GeneratorThrow.
+// EmitGeneratorResume is called in any case, as it needs to reconstruct the
+// stack frame and make space for arguments and operands.
RUNTIME_FUNCTION(Runtime_ResumeJSGeneratorObject) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 3);
@@ -128,7 +113,10 @@
JSGeneratorObject::ResumeMode resume_mode =
static_cast<JSGeneratorObject::ResumeMode>(resume_mode_int);
switch (resume_mode) {
+ // Note: this looks like NEXT and RETURN are the same but RETURN receives
+ // special treatment in the generator code (to which we return here).
case JSGeneratorObject::NEXT:
+ case JSGeneratorObject::RETURN:
return value;
case JSGeneratorObject::THROW:
return isolate->Throw(value);
@@ -180,6 +168,16 @@
}
+// Returns input of generator activation.
+RUNTIME_FUNCTION(Runtime_GeneratorGetInput) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
+
+ return generator->input();
+}
+
+
// Returns generator continuation as a PC offset, or the magic -1 or 0 values.
RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) {
HandleScope scope(isolate);
@@ -198,26 +196,33 @@
if (generator->is_suspended()) {
Handle<Code> code(generator->function()->code(), isolate);
int offset = generator->continuation();
-
- RUNTIME_ASSERT(0 <= offset && offset < code->Size());
- Address pc = code->address() + offset;
-
- return Smi::FromInt(code->SourcePosition(pc));
+ RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size());
+ return Smi::FromInt(code->SourcePosition(offset));
}
return isolate->heap()->undefined_value();
}
+// Optimization for the following three functions is disabled in
+// js/generator.js and compiler/ast-graph-builder.cc.
+
+
RUNTIME_FUNCTION(Runtime_GeneratorNext) {
- UNREACHABLE(); // Optimization disabled in SetUpGenerators().
- return NULL;
+ UNREACHABLE();
+ return nullptr;
+}
+
+
+RUNTIME_FUNCTION(Runtime_GeneratorReturn) {
+ UNREACHABLE();
+ return nullptr;
}
RUNTIME_FUNCTION(Runtime_GeneratorThrow) {
- UNREACHABLE(); // Optimization disabled in SetUpGenerators().
- return NULL;
+ UNREACHABLE();
+ return nullptr;
}
} // namespace internal
} // namespace v8