OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 Node* result = assembler->CallRuntime( | 58 Node* result = assembler->CallRuntime( |
59 Runtime::kThrowIncompatibleMethodReceiver, context, | 59 Runtime::kThrowIncompatibleMethodReceiver, context, |
60 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( | 60 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( |
61 method_name, TENURED)), | 61 method_name, TENURED)), |
62 receiver); | 62 receiver); |
63 assembler->Return(result); // Never reached. | 63 assembler->Return(result); // Never reached. |
64 } | 64 } |
65 | 65 |
66 assembler->Bind(&if_receiverisclosed); | 66 assembler->Bind(&if_receiverisclosed); |
67 { | 67 { |
| 68 Callable create_iter_result_object = |
| 69 CodeFactory::CreateIterResultObject(assembler->isolate()); |
| 70 |
68 // The {receiver} is closed already. | 71 // The {receiver} is closed already. |
69 Node* result = nullptr; | 72 Node* result = nullptr; |
70 switch (resume_mode) { | 73 switch (resume_mode) { |
71 case JSGeneratorObject::kNext: | 74 case JSGeneratorObject::kNext: |
72 result = assembler->CallRuntime(Runtime::kCreateIterResultObject, | 75 result = assembler->CallStub(create_iter_result_object, context, |
73 context, assembler->UndefinedConstant(), | 76 assembler->UndefinedConstant(), |
74 assembler->BooleanConstant(true)); | 77 assembler->TrueConstant()); |
75 break; | 78 break; |
76 case JSGeneratorObject::kReturn: | 79 case JSGeneratorObject::kReturn: |
77 result = | 80 result = assembler->CallStub(create_iter_result_object, context, value, |
78 assembler->CallRuntime(Runtime::kCreateIterResultObject, context, | 81 assembler->TrueConstant()); |
79 value, assembler->BooleanConstant(true)); | |
80 break; | 82 break; |
81 case JSGeneratorObject::kThrow: | 83 case JSGeneratorObject::kThrow: |
82 result = assembler->CallRuntime(Runtime::kThrow, context, value); | 84 result = assembler->CallRuntime(Runtime::kThrow, context, value); |
83 break; | 85 break; |
84 } | 86 } |
85 assembler->Return(result); | 87 assembler->Return(result); |
86 } | 88 } |
87 | 89 |
88 assembler->Bind(&if_receiverisrunning); | 90 assembler->Bind(&if_receiverisrunning); |
89 { | 91 { |
(...skipping 24 matching lines...) Expand all Loading... |
114 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) | 116 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) |
115 void Builtins::Generate_GeneratorPrototypeThrow( | 117 void Builtins::Generate_GeneratorPrototypeThrow( |
116 compiler::CodeAssemblerState* state) { | 118 compiler::CodeAssemblerState* state) { |
117 CodeStubAssembler assembler(state); | 119 CodeStubAssembler assembler(state); |
118 Generate_GeneratorPrototypeResume(&assembler, JSGeneratorObject::kThrow, | 120 Generate_GeneratorPrototypeResume(&assembler, JSGeneratorObject::kThrow, |
119 "[Generator].prototype.throw"); | 121 "[Generator].prototype.throw"); |
120 } | 122 } |
121 | 123 |
122 } // namespace internal | 124 } // namespace internal |
123 } // namespace v8 | 125 } // namespace v8 |
OLD | NEW |