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

Side by Side Diff: src/runtime/runtime-generator.cc

Issue 2045193002: [runtime] Deprecate RUNTIME_ASSERT from object ops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 6 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
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | src/runtime/runtime-object.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/frames-inl.h" 10 #include "src/frames-inl.h"
11 #include "src/objects-inl.h" 11 #include "src/objects-inl.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) { 16 RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
17 HandleScope scope(isolate); 17 HandleScope scope(isolate);
18 DCHECK(args.length() == 2); 18 DCHECK(args.length() == 2);
19 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 19 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
20 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); 20 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
21 RUNTIME_ASSERT(function->shared()->is_resumable()); 21 CHECK(function->shared()->is_resumable());
22 22
23 Handle<FixedArray> operand_stack; 23 Handle<FixedArray> operand_stack;
24 if (FLAG_ignition && FLAG_ignition_generators) { 24 if (FLAG_ignition && FLAG_ignition_generators) {
25 int size = function->shared()->bytecode_array()->register_count(); 25 int size = function->shared()->bytecode_array()->register_count();
26 operand_stack = isolate->factory()->NewFixedArray(size); 26 operand_stack = isolate->factory()->NewFixedArray(size);
27 } else { 27 } else {
28 DCHECK(!function->shared()->HasBytecodeArray()); 28 DCHECK(!function->shared()->HasBytecodeArray());
29 operand_stack = handle(isolate->heap()->empty_fixed_array()); 29 operand_stack = handle(isolate->heap()->empty_fixed_array());
30 } 30 }
31 31
32 Handle<JSGeneratorObject> generator = 32 Handle<JSGeneratorObject> generator =
33 isolate->factory()->NewJSGeneratorObject(function); 33 isolate->factory()->NewJSGeneratorObject(function);
34 generator->set_function(*function); 34 generator->set_function(*function);
35 generator->set_context(isolate->context()); 35 generator->set_context(isolate->context());
36 generator->set_receiver(*receiver); 36 generator->set_receiver(*receiver);
37 generator->set_operand_stack(*operand_stack); 37 generator->set_operand_stack(*operand_stack);
38 generator->set_continuation(JSGeneratorObject::kGeneratorExecuting); 38 generator->set_continuation(JSGeneratorObject::kGeneratorExecuting);
39 return *generator; 39 return *generator;
40 } 40 }
41 41
42 42
43 RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) { 43 RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) {
44 HandleScope handle_scope(isolate); 44 HandleScope handle_scope(isolate);
45 DCHECK(args.length() == 1); 45 DCHECK(args.length() == 1);
46 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0); 46 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator_object, 0);
47 47
48 JavaScriptFrameIterator stack_iterator(isolate); 48 JavaScriptFrameIterator stack_iterator(isolate);
49 JavaScriptFrame* frame = stack_iterator.frame(); 49 JavaScriptFrame* frame = stack_iterator.frame();
50 RUNTIME_ASSERT(frame->function()->shared()->is_resumable()); 50 CHECK(frame->function()->shared()->is_resumable());
51 DCHECK_EQ(frame->function(), generator_object->function()); 51 DCHECK_EQ(frame->function(), generator_object->function());
52 DCHECK(frame->function()->shared()->is_compiled()); 52 DCHECK(frame->function()->shared()->is_compiled());
53 DCHECK(!frame->function()->IsOptimized()); 53 DCHECK(!frame->function()->IsOptimized());
54 54
55 if (generator_object->function()->shared()->is_async()) { 55 if (generator_object->function()->shared()->is_async()) {
56 isolate->debug()->RecordAsyncFunction(generator_object); 56 isolate->debug()->RecordAsyncFunction(generator_object);
57 } 57 }
58 58
59 // The caller should have saved the context and continuation already. 59 // The caller should have saved the context and continuation already.
60 DCHECK_EQ(generator_object->context(), Context::cast(frame->context())); 60 DCHECK_EQ(generator_object->context(), Context::cast(frame->context()));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DCHECK(args.length() == 1); 146 DCHECK(args.length() == 1);
147 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); 147 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
148 148
149 if (!generator->is_suspended()) return isolate->heap()->undefined_value(); 149 if (!generator->is_suspended()) return isolate->heap()->undefined_value();
150 150
151 if (FLAG_ignition && FLAG_ignition_generators) UNIMPLEMENTED(); 151 if (FLAG_ignition && FLAG_ignition_generators) UNIMPLEMENTED();
152 152
153 DCHECK(!generator->function()->shared()->HasBytecodeArray()); 153 DCHECK(!generator->function()->shared()->HasBytecodeArray());
154 Handle<Code> code(generator->function()->code(), isolate); 154 Handle<Code> code(generator->function()->code(), isolate);
155 int offset = generator->continuation(); 155 int offset = generator->continuation();
156 RUNTIME_ASSERT(0 <= offset && offset < code->instruction_size()); 156 CHECK(0 <= offset && offset < code->instruction_size());
157 return Smi::FromInt(code->SourcePosition(offset)); 157 return Smi::FromInt(code->SourcePosition(offset));
158 } 158 }
159 159
160 } // namespace internal 160 } // namespace internal
161 } // namespace v8 161 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698