Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2510743002: [interpreter] Bytecode for StaDataPropertyInLiteral. (Closed)
Patch Set: Add comment and move interpreter function. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 .StoreAccumulatorInRegister(args[2]) 1424 .StoreAccumulatorInRegister(args[2])
1425 .LoadLiteral(Smi::FromInt(expr->end_position())) 1425 .LoadLiteral(Smi::FromInt(expr->end_position()))
1426 .StoreAccumulatorInRegister(args[3]) 1426 .StoreAccumulatorInRegister(args[3])
1427 .CallRuntime(Runtime::kDefineClass, args); 1427 .CallRuntime(Runtime::kDefineClass, args);
1428 } 1428 }
1429 1429
1430 void BytecodeGenerator::VisitClassLiteralProperties(ClassLiteral* expr, 1430 void BytecodeGenerator::VisitClassLiteralProperties(ClassLiteral* expr,
1431 Register literal, 1431 Register literal,
1432 Register prototype) { 1432 Register prototype) {
1433 RegisterAllocationScope register_scope(this); 1433 RegisterAllocationScope register_scope(this);
1434 RegisterList args = register_allocator()->NewRegisterList(5); 1434 RegisterList args = register_allocator()->NewRegisterList(4);
1435 Register receiver = args[0], key = args[1], value = args[2], attr = args[3], 1435 Register receiver = args[0], key = args[1], value = args[2], attr = args[3];
1436 set_function_name = args[4];
1437 1436
1438 bool attr_assigned = false; 1437 bool attr_assigned = false;
1439 Register old_receiver = Register::invalid_value(); 1438 Register old_receiver = Register::invalid_value();
1440 1439
1441 // Create nodes to store method values into the literal. 1440 // Create nodes to store method values into the literal.
1442 for (int i = 0; i < expr->properties()->length(); i++) { 1441 for (int i = 0; i < expr->properties()->length(); i++) {
1443 ClassLiteral::Property* property = expr->properties()->at(i); 1442 ClassLiteral::Property* property = expr->properties()->at(i);
1444 1443
1445 // Set-up receiver. 1444 // Set-up receiver.
1446 Register new_receiver = property->is_static() ? literal : prototype; 1445 Register new_receiver = property->is_static() ? literal : prototype;
(...skipping 26 matching lines...) Expand all
1473 builder() 1472 builder()
1474 ->LoadLiteral(Smi::FromInt(DONT_ENUM)) 1473 ->LoadLiteral(Smi::FromInt(DONT_ENUM))
1475 .StoreAccumulatorInRegister(attr); 1474 .StoreAccumulatorInRegister(attr);
1476 attr_assigned = true; 1475 attr_assigned = true;
1477 } 1476 }
1478 1477
1479 switch (property->kind()) { 1478 switch (property->kind()) {
1480 case ClassLiteral::Property::METHOD: { 1479 case ClassLiteral::Property::METHOD: {
1481 builder() 1480 builder()
1482 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) 1481 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName()))
1483 .StoreAccumulatorInRegister(set_function_name) 1482 .StoreDataPropertyInLiteral(receiver, key, value, attr);
1484 .CallRuntime(Runtime::kDefineDataPropertyInLiteral, args);
1485 break; 1483 break;
1486 } 1484 }
1487 case ClassLiteral::Property::GETTER: { 1485 case ClassLiteral::Property::GETTER: {
1488 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, 1486 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, args);
1489 args.Truncate(4));
1490 break; 1487 break;
1491 } 1488 }
1492 case ClassLiteral::Property::SETTER: { 1489 case ClassLiteral::Property::SETTER: {
1493 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, 1490 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, args);
1494 args.Truncate(4));
1495 break; 1491 break;
1496 } 1492 }
1497 case ClassLiteral::Property::FIELD: { 1493 case ClassLiteral::Property::FIELD: {
1498 UNREACHABLE(); 1494 UNREACHABLE();
1499 break; 1495 break;
1500 } 1496 }
1501 } 1497 }
1502 } 1498 }
1503 } 1499 }
1504 1500
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 builder()->MoveRegister(literal, args[0]); 1688 builder()->MoveRegister(literal, args[0]);
1693 VisitForRegisterValue(property->value(), args[1]); 1689 VisitForRegisterValue(property->value(), args[1]);
1694 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); 1690 builder()->CallRuntime(Runtime::kInternalSetPrototype, args);
1695 continue; 1691 continue;
1696 } 1692 }
1697 1693
1698 switch (property->kind()) { 1694 switch (property->kind()) {
1699 case ObjectLiteral::Property::CONSTANT: 1695 case ObjectLiteral::Property::CONSTANT:
1700 case ObjectLiteral::Property::COMPUTED: 1696 case ObjectLiteral::Property::COMPUTED:
1701 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { 1697 case ObjectLiteral::Property::MATERIALIZED_LITERAL: {
1702 RegisterList args = register_allocator()->NewRegisterList(5); 1698 Register key = register_allocator()->NewRegister();
1703 builder()->MoveRegister(literal, args[0]);
1704 VisitForAccumulatorValue(property->key()); 1699 VisitForAccumulatorValue(property->key());
1705 builder()->ConvertAccumulatorToName(args[1]); 1700 builder()->ConvertAccumulatorToName(key);
1706 VisitForRegisterValue(property->value(), args[2]); 1701
1707 VisitSetHomeObject(args[2], literal, property); 1702 Register value = VisitForRegisterValue(property->value());
1703 VisitSetHomeObject(value, literal, property);
1704
1705 Register attr = register_allocator()->NewRegister();
1706
1708 builder() 1707 builder()
1709 ->LoadLiteral(Smi::FromInt(NONE)) 1708 ->LoadLiteral(Smi::FromInt(NONE))
1710 .StoreAccumulatorInRegister(args[3]) 1709 .StoreAccumulatorInRegister(attr)
1711 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) 1710 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName()))
1712 .StoreAccumulatorInRegister(args[4]); 1711 .StoreDataPropertyInLiteral(literal, key, value, attr);
1713 builder()->CallRuntime(Runtime::kDefineDataPropertyInLiteral, args);
1714 break; 1712 break;
1715 } 1713 }
1716 case ObjectLiteral::Property::GETTER: 1714 case ObjectLiteral::Property::GETTER:
1717 case ObjectLiteral::Property::SETTER: { 1715 case ObjectLiteral::Property::SETTER: {
1718 RegisterList args = register_allocator()->NewRegisterList(4); 1716 RegisterList args = register_allocator()->NewRegisterList(4);
1719 builder()->MoveRegister(literal, args[0]); 1717 builder()->MoveRegister(literal, args[0]);
1720 VisitForAccumulatorValue(property->key()); 1718 VisitForAccumulatorValue(property->key());
1721 builder()->ConvertAccumulatorToName(args[1]); 1719 builder()->ConvertAccumulatorToName(args[1]);
1722 VisitForRegisterValue(property->value(), args[2]); 1720 VisitForRegisterValue(property->value(), args[2]);
1723 VisitSetHomeObject(args[2], literal, property); 1721 VisitSetHomeObject(args[2], literal, property);
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 } 3183 }
3186 3184
3187 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3185 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3188 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3186 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3189 : Runtime::kStoreKeyedToSuper_Sloppy; 3187 : Runtime::kStoreKeyedToSuper_Sloppy;
3190 } 3188 }
3191 3189
3192 } // namespace interpreter 3190 } // namespace interpreter
3193 } // namespace internal 3191 } // namespace internal
3194 } // namespace v8 3192 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698