OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/interpreter/control-flow-builders.h" | 8 #include "src/interpreter/control-flow-builders.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 Register callee = execution_result()->NewRegister(); | 1296 Register callee = execution_result()->NewRegister(); |
1297 | 1297 |
1298 // The receiver and arguments need to be allocated consecutively for | 1298 // The receiver and arguments need to be allocated consecutively for |
1299 // Call(). Future optimizations could avoid this there are no | 1299 // Call(). Future optimizations could avoid this there are no |
1300 // arguments or the receiver and arguments are already consecutive. | 1300 // arguments or the receiver and arguments are already consecutive. |
1301 ZoneList<Expression*>* args = expr->arguments(); | 1301 ZoneList<Expression*>* args = expr->arguments(); |
1302 execution_result()->PrepareForConsecutiveAllocations(args->length() + 1); | 1302 execution_result()->PrepareForConsecutiveAllocations(args->length() + 1); |
1303 Register receiver = execution_result()->NextConsecutiveRegister(); | 1303 Register receiver = execution_result()->NextConsecutiveRegister(); |
1304 | 1304 |
1305 switch (call_type) { | 1305 switch (call_type) { |
1306 case Call::PROPERTY_CALL: { | 1306 case Call::NAMED_PROPERTY_CALL: |
| 1307 case Call::KEYED_PROPERTY_CALL: { |
1307 Property* property = callee_expr->AsProperty(); | 1308 Property* property = callee_expr->AsProperty(); |
1308 if (property->IsSuperAccess()) { | |
1309 UNIMPLEMENTED(); | |
1310 } | |
1311 | |
1312 VisitForAccumulatorValue(property->obj()); | 1309 VisitForAccumulatorValue(property->obj()); |
1313 builder()->StoreAccumulatorInRegister(receiver); | 1310 builder()->StoreAccumulatorInRegister(receiver); |
1314 VisitPropertyLoadForAccumulator(receiver, property); | 1311 VisitPropertyLoadForAccumulator(receiver, property); |
1315 builder()->StoreAccumulatorInRegister(callee); | 1312 builder()->StoreAccumulatorInRegister(callee); |
1316 break; | 1313 break; |
1317 } | 1314 } |
1318 case Call::GLOBAL_CALL: { | 1315 case Call::GLOBAL_CALL: { |
1319 // Receiver is undefined for global calls. | 1316 // Receiver is undefined for global calls. |
1320 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); | 1317 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); |
1321 // Load callee as a global variable. | 1318 // Load callee as a global variable. |
1322 VariableProxy* proxy = callee_expr->AsVariableProxy(); | 1319 VariableProxy* proxy = callee_expr->AsVariableProxy(); |
1323 VisitVariableLoadForAccumulatorValue(proxy->var(), | 1320 VisitVariableLoadForAccumulatorValue(proxy->var(), |
1324 proxy->VariableFeedbackSlot()); | 1321 proxy->VariableFeedbackSlot()); |
1325 builder()->StoreAccumulatorInRegister(callee); | 1322 builder()->StoreAccumulatorInRegister(callee); |
1326 break; | 1323 break; |
1327 } | 1324 } |
1328 case Call::OTHER_CALL: { | 1325 case Call::OTHER_CALL: { |
1329 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); | 1326 builder()->LoadUndefined().StoreAccumulatorInRegister(receiver); |
1330 VisitForAccumulatorValue(callee_expr); | 1327 VisitForAccumulatorValue(callee_expr); |
1331 builder()->StoreAccumulatorInRegister(callee); | 1328 builder()->StoreAccumulatorInRegister(callee); |
1332 break; | 1329 break; |
1333 } | 1330 } |
| 1331 case Call::NAMED_SUPER_PROPERTY_CALL: |
| 1332 case Call::KEYED_SUPER_PROPERTY_CALL: |
1334 case Call::LOOKUP_SLOT_CALL: | 1333 case Call::LOOKUP_SLOT_CALL: |
1335 case Call::SUPER_CALL: | 1334 case Call::SUPER_CALL: |
1336 case Call::POSSIBLY_EVAL_CALL: | 1335 case Call::POSSIBLY_EVAL_CALL: |
1337 UNIMPLEMENTED(); | 1336 UNIMPLEMENTED(); |
1338 } | 1337 } |
1339 | 1338 |
1340 // Evaluate all arguments to the function call and store in sequential | 1339 // Evaluate all arguments to the function call and store in sequential |
1341 // registers. | 1340 // registers. |
1342 if (args->length() > 0) { | 1341 if (args->length() > 0) { |
1343 Register arg = VisitArguments(args); | 1342 Register arg = VisitArguments(args); |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 } | 1946 } |
1948 | 1947 |
1949 | 1948 |
1950 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 1949 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
1951 return info()->feedback_vector()->GetIndex(slot); | 1950 return info()->feedback_vector()->GetIndex(slot); |
1952 } | 1951 } |
1953 | 1952 |
1954 } // namespace interpreter | 1953 } // namespace interpreter |
1955 } // namespace internal | 1954 } // namespace internal |
1956 } // namespace v8 | 1955 } // namespace v8 |
OLD | NEW |