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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); | 3011 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); |
3012 args->Add(value, zone()); | 3012 args->Add(value, zone()); |
3013 Expression* call_runtime = | 3013 Expression* call_runtime = |
3014 factory()->NewCallRuntime(Context::PROMISE_RESOLVE_INDEX, args, pos); | 3014 factory()->NewCallRuntime(Context::PROMISE_RESOLVE_INDEX, args, pos); |
3015 return factory()->NewBinaryOperation( | 3015 return factory()->NewBinaryOperation( |
3016 Token::COMMA, call_runtime, | 3016 Token::COMMA, call_runtime, |
3017 factory()->NewVariableProxy(PromiseVariable()), pos); | 3017 factory()->NewVariableProxy(PromiseVariable()), pos); |
3018 } | 3018 } |
3019 | 3019 |
3020 Expression* Parser::BuildRejectPromise(Expression* value, int pos) { | 3020 Expression* Parser::BuildRejectPromise(Expression* value, int pos) { |
3021 // %RejectPromiseNoDebugEvent(.promise, value, true), .promise | 3021 // %promise_internal_reject(.promise, value, false), .promise |
3022 // The NoDebugEvent variant disables the additional debug event for the | 3022 // Disables the additional debug event for the rejection since a debug event |
3023 // rejection since a debug event already happened for the exception that got | 3023 // already happened for the exception that got us here. |
3024 // us here. | 3024 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(3, zone()); |
3025 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); | |
3026 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); | 3025 args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); |
3027 args->Add(value, zone()); | 3026 args->Add(value, zone()); |
| 3027 args->Add(factory()->NewBooleanLiteral(false, pos), zone()); |
3028 Expression* call_runtime = factory()->NewCallRuntime( | 3028 Expression* call_runtime = factory()->NewCallRuntime( |
3029 Context::REJECT_PROMISE_NO_DEBUG_EVENT_INDEX, args, pos); | 3029 Context::PROMISE_INTERNAL_REJECT_INDEX, args, pos); |
3030 return factory()->NewBinaryOperation( | 3030 return factory()->NewBinaryOperation( |
3031 Token::COMMA, call_runtime, | 3031 Token::COMMA, call_runtime, |
3032 factory()->NewVariableProxy(PromiseVariable()), pos); | 3032 factory()->NewVariableProxy(PromiseVariable()), pos); |
3033 } | 3033 } |
3034 | 3034 |
3035 Variable* Parser::PromiseVariable() { | 3035 Variable* Parser::PromiseVariable() { |
3036 // Based on the various compilation paths, there are many different code | 3036 // Based on the various compilation paths, there are many different code |
3037 // paths which may be the first to access the Promise temporary. Whichever | 3037 // paths which may be the first to access the Promise temporary. Whichever |
3038 // comes first should create it and stash it in the FunctionState. | 3038 // comes first should create it and stash it in the FunctionState. |
3039 Variable* promise = function_state_->promise_variable(); | 3039 Variable* promise = function_state_->promise_variable(); |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5116 | 5116 |
5117 return final_loop; | 5117 return final_loop; |
5118 } | 5118 } |
5119 | 5119 |
5120 #undef CHECK_OK | 5120 #undef CHECK_OK |
5121 #undef CHECK_OK_VOID | 5121 #undef CHECK_OK_VOID |
5122 #undef CHECK_FAILED | 5122 #undef CHECK_FAILED |
5123 | 5123 |
5124 } // namespace internal | 5124 } // namespace internal |
5125 } // namespace v8 | 5125 } // namespace v8 |
OLD | NEW |