OLD | NEW |
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 "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3138 } | 3138 } |
3139 | 3139 |
3140 Statement* try_finally_statement = factory()->NewTryFinallyStatement( | 3140 Statement* try_finally_statement = factory()->NewTryFinallyStatement( |
3141 outer_try_block, finally_block, kNoSourcePosition); | 3141 outer_try_block, finally_block, kNoSourcePosition); |
3142 | 3142 |
3143 result->statements()->Add(try_finally_statement, zone()); | 3143 result->statements()->Add(try_finally_statement, zone()); |
3144 return result; | 3144 return result; |
3145 } | 3145 } |
3146 | 3146 |
3147 Assignment* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) { | 3147 Assignment* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) { |
3148 // .generator = %CreateJSGeneratorObject(...); | 3148 // .generator = %_CreateJSGeneratorObject(...); |
3149 DCHECK_NOT_NULL(function_state_->generator_object_variable()); | 3149 DCHECK_NOT_NULL(function_state_->generator_object_variable()); |
3150 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); | 3150 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); |
3151 args->Add(factory()->NewThisFunction(pos), zone()); | 3151 args->Add(factory()->NewThisFunction(pos), zone()); |
3152 args->Add(IsArrowFunction(kind) ? GetLiteralUndefined(pos) | 3152 args->Add(IsArrowFunction(kind) ? GetLiteralUndefined(pos) |
3153 : ThisExpression(kNoSourcePosition), | 3153 : ThisExpression(kNoSourcePosition), |
3154 zone()); | 3154 zone()); |
3155 Expression* allocation = | 3155 Expression* allocation = factory()->NewCallRuntime( |
3156 factory()->NewCallRuntime(Runtime::kCreateJSGeneratorObject, args, pos); | 3156 Runtime::kInlineCreateJSGeneratorObject, args, pos); |
3157 VariableProxy* proxy = | 3157 VariableProxy* proxy = |
3158 factory()->NewVariableProxy(function_state_->generator_object_variable()); | 3158 factory()->NewVariableProxy(function_state_->generator_object_variable()); |
3159 return factory()->NewAssignment(Token::INIT, proxy, allocation, | 3159 return factory()->NewAssignment(Token::INIT, proxy, allocation, |
3160 kNoSourcePosition); | 3160 kNoSourcePosition); |
3161 } | 3161 } |
3162 | 3162 |
3163 Expression* Parser::BuildResolvePromise(Expression* value, int pos) { | 3163 Expression* Parser::BuildResolvePromise(Expression* value, int pos) { |
3164 // %ResolvePromise(.promise, value), .promise | 3164 // %ResolvePromise(.promise, value), .promise |
3165 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); | 3165 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); |
3166 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); | 3166 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); |
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5232 literal->SetShouldEagerCompile(); | 5232 literal->SetShouldEagerCompile(); |
5233 } | 5233 } |
5234 } | 5234 } |
5235 | 5235 |
5236 #undef CHECK_OK | 5236 #undef CHECK_OK |
5237 #undef CHECK_OK_VOID | 5237 #undef CHECK_OK_VOID |
5238 #undef CHECK_FAILED | 5238 #undef CHECK_FAILED |
5239 | 5239 |
5240 } // namespace internal | 5240 } // namespace internal |
5241 } // namespace v8 | 5241 } // namespace v8 |
OLD | NEW |