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/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 for (int i = 0; i < expr->properties()->length(); i++) { | 1463 for (int i = 0; i < expr->properties()->length(); i++) { |
1464 ClassLiteral::Property* property = expr->properties()->at(i); | 1464 ClassLiteral::Property* property = expr->properties()->at(i); |
1465 | 1465 |
1466 // Set-up receiver. | 1466 // Set-up receiver. |
1467 Register new_receiver = property->is_static() ? constructor : prototype; | 1467 Register new_receiver = property->is_static() ? constructor : prototype; |
1468 if (new_receiver != old_receiver) { | 1468 if (new_receiver != old_receiver) { |
1469 builder()->MoveRegister(new_receiver, receiver); | 1469 builder()->MoveRegister(new_receiver, receiver); |
1470 old_receiver = new_receiver; | 1470 old_receiver = new_receiver; |
1471 } | 1471 } |
1472 | 1472 |
1473 VisitForAccumulatorValue(property->key()); | 1473 if (property->key()->IsStringLiteral()) { |
1474 builder()->ConvertAccumulatorToName(key); | 1474 VisitForRegisterValue(property->key(), key); |
| 1475 } else { |
| 1476 VisitForAccumulatorValue(property->key()); |
| 1477 builder()->ConvertAccumulatorToName(key); |
| 1478 } |
1475 | 1479 |
1476 if (property->is_static() && property->is_computed_name()) { | 1480 if (property->is_static() && property->is_computed_name()) { |
1477 // The static prototype property is read only. We handle the non computed | 1481 // The static prototype property is read only. We handle the non computed |
1478 // property name case in the parser. Since this is the only case where we | 1482 // property name case in the parser. Since this is the only case where we |
1479 // need to check for an own read only property we special case this so we | 1483 // need to check for an own read only property we special case this so we |
1480 // do not need to do this for every property. | 1484 // do not need to do this for every property. |
1481 BytecodeLabel done; | 1485 BytecodeLabel done; |
1482 builder() | 1486 builder() |
1483 ->LoadLiteral(prototype_string()) | 1487 ->LoadLiteral(prototype_string()) |
1484 .CompareOperation(Token::Value::EQ_STRICT, key) | 1488 .CompareOperation(Token::Value::EQ_STRICT, key) |
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 } | 3311 } |
3308 | 3312 |
3309 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3313 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3310 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3314 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3311 : Runtime::kStoreKeyedToSuper_Sloppy; | 3315 : Runtime::kStoreKeyedToSuper_Sloppy; |
3312 } | 3316 } |
3313 | 3317 |
3314 } // namespace interpreter | 3318 } // namespace interpreter |
3315 } // namespace internal | 3319 } // namespace internal |
3316 } // namespace v8 | 3320 } // namespace v8 |
OLD | NEW |