| 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/parser.h" | 5 #include "src/parser.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 ZoneList<Statement*>* body = NULL; | 352 ZoneList<Statement*>* body = NULL; |
| 353 | 353 |
| 354 { | 354 { |
| 355 AstNodeFactory function_factory(ast_value_factory()); | 355 AstNodeFactory function_factory(ast_value_factory()); |
| 356 FunctionState function_state(&function_state_, &scope_, function_scope, | 356 FunctionState function_state(&function_state_, &scope_, function_scope, |
| 357 kind, &function_factory); | 357 kind, &function_factory); |
| 358 | 358 |
| 359 body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone()); | 359 body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone()); |
| 360 AddAssertIsConstruct(body, pos); | 360 AddAssertIsConstruct(body, pos); |
| 361 if (call_super) { | 361 if (call_super) { |
| 362 // %_DefaultConstructorCallSuper(new.target, .this_function) | 362 // %_DefaultConstructorCallSuper(new.target, %GetPrototype(<this-fun>)) |
| 363 ZoneList<Expression*>* args = | 363 ZoneList<Expression*>* args = |
| 364 new (zone()) ZoneList<Expression*>(2, zone()); | 364 new (zone()) ZoneList<Expression*>(2, zone()); |
| 365 VariableProxy* new_target_proxy = scope_->NewUnresolved( | 365 VariableProxy* new_target_proxy = scope_->NewUnresolved( |
| 366 factory(), ast_value_factory()->new_target_string(), Variable::NORMAL, | 366 factory(), ast_value_factory()->new_target_string(), Variable::NORMAL, |
| 367 pos); | 367 pos); |
| 368 args->Add(new_target_proxy, zone()); | 368 args->Add(new_target_proxy, zone()); |
| 369 VariableProxy* this_function_proxy = scope_->NewUnresolved( | 369 VariableProxy* this_function_proxy = scope_->NewUnresolved( |
| 370 factory(), ast_value_factory()->this_function_string(), | 370 factory(), ast_value_factory()->this_function_string(), |
| 371 Variable::NORMAL, pos); | 371 Variable::NORMAL, pos); |
| 372 args->Add(this_function_proxy, zone()); | 372 ZoneList<Expression*>* tmp = |
| 373 new (zone()) ZoneList<Expression*>(1, zone()); |
| 374 tmp->Add(this_function_proxy, zone()); |
| 375 Expression* get_prototype = |
| 376 factory()->NewCallRuntime(Runtime::kGetPrototype, tmp, pos); |
| 377 args->Add(get_prototype, zone()); |
| 373 CallRuntime* call = factory()->NewCallRuntime( | 378 CallRuntime* call = factory()->NewCallRuntime( |
| 374 Runtime::kInlineDefaultConstructorCallSuper, args, pos); | 379 Runtime::kInlineDefaultConstructorCallSuper, args, pos); |
| 375 body->Add(factory()->NewReturnStatement(call, pos), zone()); | 380 body->Add(factory()->NewReturnStatement(call, pos), zone()); |
| 376 } | 381 } |
| 377 | 382 |
| 378 materialized_literal_count = function_state.materialized_literal_count(); | 383 materialized_literal_count = function_state.materialized_literal_count(); |
| 379 expected_property_count = function_state.expected_property_count(); | 384 expected_property_count = function_state.expected_property_count(); |
| 380 } | 385 } |
| 381 | 386 |
| 382 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( | 387 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( |
| (...skipping 5821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6204 | 6209 |
| 6205 Expression* Parser::SpreadCallNew(Expression* function, | 6210 Expression* Parser::SpreadCallNew(Expression* function, |
| 6206 ZoneList<v8::internal::Expression*>* args, | 6211 ZoneList<v8::internal::Expression*>* args, |
| 6207 int pos) { | 6212 int pos) { |
| 6208 args->InsertAt(0, function, zone()); | 6213 args->InsertAt(0, function, zone()); |
| 6209 | 6214 |
| 6210 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6215 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
| 6211 } | 6216 } |
| 6212 } // namespace internal | 6217 } // namespace internal |
| 6213 } // namespace v8 | 6218 } // namespace v8 |
| OLD | NEW |