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/v8.h" | 5 #include "src/v8.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 5913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5924 } | 5924 } |
5925 UNREACHABLE(); | 5925 UNREACHABLE(); |
5926 } | 5926 } |
5927 | 5927 |
5928 | 5928 |
5929 Expression* Parser::SpreadCall(Expression* function, | 5929 Expression* Parser::SpreadCall(Expression* function, |
5930 ZoneList<v8::internal::Expression*>* args, | 5930 ZoneList<v8::internal::Expression*>* args, |
5931 int pos) { | 5931 int pos) { |
5932 if (function->IsSuperCallReference()) { | 5932 if (function->IsSuperCallReference()) { |
5933 // Super calls | 5933 // Super calls |
5934 // %_CallSuperWithSpread(%ReflectConstruct(<super>, args, new.target)) | 5934 // %ReflectConstruct(%GetPrototype(<this-function>), args, new.target)) |
5935 args->InsertAt(0, function, zone()); | 5935 ZoneList<Expression*>* tmp = new (zone()) ZoneList<Expression*>(1, zone()); |
| 5936 tmp->Add(function->AsSuperCallReference()->this_function_var(), zone()); |
| 5937 Expression* get_prototype = factory()->NewCallRuntime( |
| 5938 ast_value_factory()->empty_string(), |
| 5939 Runtime::FunctionForId(Runtime::kGetPrototype), tmp, pos); |
| 5940 args->InsertAt(0, get_prototype, zone()); |
5936 args->Add(function->AsSuperCallReference()->new_target_var(), zone()); | 5941 args->Add(function->AsSuperCallReference()->new_target_var(), zone()); |
5937 Expression* result = factory()->NewCallRuntime( | 5942 return factory()->NewCallRuntime( |
5938 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5943 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5939 args = new (zone()) ZoneList<Expression*>(1, zone()); | |
5940 args->Add(result, zone()); | |
5941 return factory()->NewCallRuntime( | |
5942 ast_value_factory()->empty_string(), | |
5943 Runtime::FunctionForId(Runtime::kInlineCallSuperWithSpread), args, pos); | |
5944 } else { | 5944 } else { |
5945 if (function->IsProperty()) { | 5945 if (function->IsProperty()) { |
5946 // Method calls | 5946 // Method calls |
5947 if (function->AsProperty()->IsSuperAccess()) { | 5947 if (function->AsProperty()->IsSuperAccess()) { |
5948 Expression* home = | 5948 Expression* home = |
5949 ThisExpression(scope_, factory(), RelocInfo::kNoPosition); | 5949 ThisExpression(scope_, factory(), RelocInfo::kNoPosition); |
5950 args->InsertAt(0, function, zone()); | 5950 args->InsertAt(0, function, zone()); |
5951 args->InsertAt(1, home, zone()); | 5951 args->InsertAt(1, home, zone()); |
5952 } else { | 5952 } else { |
5953 Variable* temp = | 5953 Variable* temp = |
(...skipping 23 matching lines...) Expand all Loading... |
5977 Expression* Parser::SpreadCallNew(Expression* function, | 5977 Expression* Parser::SpreadCallNew(Expression* function, |
5978 ZoneList<v8::internal::Expression*>* args, | 5978 ZoneList<v8::internal::Expression*>* args, |
5979 int pos) { | 5979 int pos) { |
5980 args->InsertAt(0, function, zone()); | 5980 args->InsertAt(0, function, zone()); |
5981 | 5981 |
5982 return factory()->NewCallRuntime( | 5982 return factory()->NewCallRuntime( |
5983 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5983 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5984 } | 5984 } |
5985 } // namespace internal | 5985 } // namespace internal |
5986 } // namespace v8 | 5986 } // namespace v8 |
OLD | NEW |