Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/runtime.cc

Issue 580823002: Implement generator mirror (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits; rename generator-mirror.js to generators-mirror.js Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/es6/generators-mirror.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 14555 matching lines...) Expand 10 before | Expand all | Expand 10 after
14566 RUNTIME_FUNCTION(Runtime_GetV8Version) { 14566 RUNTIME_FUNCTION(Runtime_GetV8Version) {
14567 HandleScope scope(isolate); 14567 HandleScope scope(isolate);
14568 DCHECK(args.length() == 0); 14568 DCHECK(args.length() == 0);
14569 14569
14570 const char* version_string = v8::V8::GetVersion(); 14570 const char* version_string = v8::V8::GetVersion();
14571 14571
14572 return *isolate->factory()->NewStringFromAsciiChecked(version_string); 14572 return *isolate->factory()->NewStringFromAsciiChecked(version_string);
14573 } 14573 }
14574 14574
14575 14575
14576 // Returns function of generator activation.
14577 RUNTIME_FUNCTION(Runtime_GeneratorGetFunction) {
14578 HandleScope scope(isolate);
14579 DCHECK(args.length() == 1);
14580 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
14581
14582 return generator->function();
14583 }
14584
14585
14586 // Returns context of generator activation.
14587 RUNTIME_FUNCTION(Runtime_GeneratorGetContext) {
14588 HandleScope scope(isolate);
14589 DCHECK(args.length() == 1);
14590 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
14591
14592 return generator->context();
14593 }
14594
14595
14596 // Returns receiver of generator activation.
14597 RUNTIME_FUNCTION(Runtime_GeneratorGetReceiver) {
14598 HandleScope scope(isolate);
14599 DCHECK(args.length() == 1);
14600 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
14601
14602 return generator->receiver();
14603 }
14604
14605
14606 // Returns generator continuation as a PC offset, or the magic -1 or 0 values.
14607 RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) {
14608 HandleScope scope(isolate);
14609 DCHECK(args.length() == 1);
14610 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
14611
14612 return Smi::FromInt(generator->continuation());
14613 }
14614
14615
14616 RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) {
14617 HandleScope scope(isolate);
14618 DCHECK(args.length() == 1);
14619 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
14620
14621 if (generator->is_suspended()) {
14622 Handle<Code> code(generator->function()->code(), isolate);
14623 int offset = generator->continuation();
14624
14625 RUNTIME_ASSERT(0 <= offset && offset < code->Size());
14626 Address pc = code->address() + offset;
14627
14628 return Smi::FromInt(code->SourcePosition(pc));
14629 }
14630
14631 return isolate->heap()->undefined_value();
14632 }
14633
14634
14576 RUNTIME_FUNCTION(Runtime_Abort) { 14635 RUNTIME_FUNCTION(Runtime_Abort) {
14577 SealHandleScope shs(isolate); 14636 SealHandleScope shs(isolate);
14578 DCHECK(args.length() == 1); 14637 DCHECK(args.length() == 1);
14579 CONVERT_SMI_ARG_CHECKED(message_id, 0); 14638 CONVERT_SMI_ARG_CHECKED(message_id, 0);
14580 const char* message = GetBailoutReason( 14639 const char* message = GetBailoutReason(
14581 static_cast<BailoutReason>(message_id)); 14640 static_cast<BailoutReason>(message_id));
14582 base::OS::PrintError("abort: %s\n", message); 14641 base::OS::PrintError("abort: %s\n", message);
14583 isolate->PrintStack(stderr); 14642 isolate->PrintStack(stderr);
14584 base::OS::Abort(); 14643 base::OS::Abort();
14585 UNREACHABLE(); 14644 UNREACHABLE();
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
15647 } 15706 }
15648 return NULL; 15707 return NULL;
15649 } 15708 }
15650 15709
15651 15710
15652 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15711 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15653 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15712 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15654 } 15713 }
15655 15714
15656 } } // namespace v8::internal 15715 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/es6/generators-mirror.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698