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

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

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: addressing nits Created 3 years, 9 months 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
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/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 ->LoadLiteral(Smi::FromInt(SLOPPY)) 1739 ->LoadLiteral(Smi::FromInt(SLOPPY))
1740 .StoreAccumulatorInRegister(args[3]) 1740 .StoreAccumulatorInRegister(args[3])
1741 .CallRuntime(Runtime::kSetProperty, args); 1741 .CallRuntime(Runtime::kSetProperty, args);
1742 Register value = args[2]; 1742 Register value = args[2];
1743 VisitSetHomeObject(value, literal, property); 1743 VisitSetHomeObject(value, literal, property);
1744 } 1744 }
1745 } 1745 }
1746 break; 1746 break;
1747 } 1747 }
1748 case ObjectLiteral::Property::PROTOTYPE: { 1748 case ObjectLiteral::Property::PROTOTYPE: {
1749 if (property->IsNullPrototype()) break;
1749 DCHECK(property->emit_store()); 1750 DCHECK(property->emit_store());
1750 RegisterList args = register_allocator()->NewRegisterList(2); 1751 RegisterList args = register_allocator()->NewRegisterList(2);
1751 builder()->MoveRegister(literal, args[0]); 1752 builder()->MoveRegister(literal, args[0]);
1752 VisitForRegisterValue(property->value(), args[1]); 1753 VisitForRegisterValue(property->value(), args[1]);
1753 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); 1754 builder()->CallRuntime(Runtime::kInternalSetPrototype, args);
1754 break; 1755 break;
1755 } 1756 }
1756 case ObjectLiteral::Property::GETTER: 1757 case ObjectLiteral::Property::GETTER:
1757 if (property->emit_store()) { 1758 if (property->emit_store()) {
1758 accessor_table.lookup(key)->second->getter = property; 1759 accessor_table.lookup(key)->second->getter = property;
(...skipping 29 matching lines...) Expand all
1788 // with the first computed property name and continues with all properties to 1789 // with the first computed property name and continues with all properties to
1789 // its right. All the code from above initializes the static component of the 1790 // its right. All the code from above initializes the static component of the
1790 // object literal, and arranges for the map of the result to reflect the 1791 // object literal, and arranges for the map of the result to reflect the
1791 // static order in which the keys appear. For the dynamic properties, we 1792 // static order in which the keys appear. For the dynamic properties, we
1792 // compile them into a series of "SetOwnProperty" runtime calls. This will 1793 // compile them into a series of "SetOwnProperty" runtime calls. This will
1793 // preserve insertion order. 1794 // preserve insertion order.
1794 for (; property_index < expr->properties()->length(); property_index++) { 1795 for (; property_index < expr->properties()->length(); property_index++) {
1795 ObjectLiteral::Property* property = expr->properties()->at(property_index); 1796 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1796 RegisterAllocationScope inner_register_scope(this); 1797 RegisterAllocationScope inner_register_scope(this);
1797 1798
1798 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { 1799 if (property->IsPrototype()) {
1800 // __proto__:null is handled by CreateObjectLiteral.
1801 if (property->IsNullPrototype()) continue;
1799 DCHECK(property->emit_store()); 1802 DCHECK(property->emit_store());
1800 RegisterList args = register_allocator()->NewRegisterList(2); 1803 RegisterList args = register_allocator()->NewRegisterList(2);
1801 builder()->MoveRegister(literal, args[0]); 1804 builder()->MoveRegister(literal, args[0]);
1802 VisitForRegisterValue(property->value(), args[1]); 1805 VisitForRegisterValue(property->value(), args[1]);
1803 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); 1806 builder()->CallRuntime(Runtime::kInternalSetPrototype, args);
1804 continue; 1807 continue;
1805 } 1808 }
1806 1809
1807 switch (property->kind()) { 1810 switch (property->kind()) {
1808 case ObjectLiteral::Property::CONSTANT: 1811 case ObjectLiteral::Property::CONSTANT:
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3471 } 3474 }
3472 3475
3473 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3476 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3474 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3477 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3475 : Runtime::kStoreKeyedToSuper_Sloppy; 3478 : Runtime::kStoreKeyedToSuper_Sloppy;
3476 } 3479 }
3477 3480
3478 } // namespace interpreter 3481 } // namespace interpreter
3479 } // namespace internal 3482 } // namespace internal
3480 } // namespace v8 3483 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698