| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // Generate code to check that a global property cell is empty. Create | 222 // Generate code to check that a global property cell is empty. Create |
| 223 // the property cell at compilation time if no cell exists for the | 223 // the property cell at compilation time if no cell exists for the |
| 224 // property. | 224 // property. |
| 225 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 225 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 226 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 226 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 227 Register scratch, Label* miss) { | 227 Register scratch, Label* miss) { |
| 228 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 228 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
| 229 DCHECK(cell->value()->IsTheHole()); | 229 DCHECK(cell->value()->IsTheHole()); |
| 230 Factory* factory = masm->isolate()->factory(); | 230 Factory* factory = masm->isolate()->factory(); |
| 231 Handle<WeakCell> weak_cell = factory->NewWeakCell(cell); | 231 Handle<WeakCell> weak_cell = factory->NewWeakCell(cell); |
| 232 __ LoadWeakValue(scratch, weak_cell, miss); | 232 __ LoadWeakValueNoReadBarrier(scratch, weak_cell, miss); |
| 233 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), | 233 __ cmp(FieldOperand(scratch, PropertyCell::kValueOffset), |
| 234 Immediate(factory->the_hole_value())); | 234 Immediate(factory->the_hole_value())); |
| 235 __ j(not_equal, miss); | 235 __ j(not_equal, miss); |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| 239 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 239 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
| 240 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 240 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
| 241 Register holder, int accessor_index, int expected_arguments, | 241 Register holder, int accessor_index, int expected_arguments, |
| 242 Register scratch) { | 242 Register scratch) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 __ mov(this->name(), Immediate(name)); | 356 __ mov(this->name(), Immediate(name)); |
| 357 } | 357 } |
| 358 | 358 |
| 359 | 359 |
| 360 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | 360 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, |
| 361 Register scratch, | 361 Register scratch, |
| 362 Label* miss) { | 362 Label* miss) { |
| 363 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | 363 Handle<WeakCell> cell = Map::WeakCellForMap(transition); |
| 364 Register map_reg = StoreTransitionDescriptor::MapRegister(); | 364 Register map_reg = StoreTransitionDescriptor::MapRegister(); |
| 365 DCHECK(!map_reg.is(scratch)); | 365 DCHECK(!map_reg.is(scratch)); |
| 366 __ LoadWeakValue(map_reg, cell, miss); | 366 __ LoadWeakValue(map_reg, cell, scratch, miss); |
| 367 if (transition->CanBeDeprecated()) { | 367 if (transition->CanBeDeprecated()) { |
| 368 __ mov(scratch, FieldOperand(map_reg, Map::kBitField3Offset)); | 368 __ mov(scratch, FieldOperand(map_reg, Map::kBitField3Offset)); |
| 369 __ and_(scratch, Immediate(Map::Deprecated::kMask)); | 369 __ and_(scratch, Immediate(Map::Deprecated::kMask)); |
| 370 __ j(not_zero, miss); | 370 __ j(not_zero, miss); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 | 374 |
| 375 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, | 375 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, |
| 376 int descriptor, | 376 int descriptor, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 // Push data from ExecutableAccessorInfo. | 560 // Push data from ExecutableAccessorInfo. |
| 561 Handle<Object> data(callback->data(), isolate()); | 561 Handle<Object> data(callback->data(), isolate()); |
| 562 if (data->IsUndefined() || data->IsSmi()) { | 562 if (data->IsUndefined() || data->IsSmi()) { |
| 563 __ push(Immediate(data)); | 563 __ push(Immediate(data)); |
| 564 } else { | 564 } else { |
| 565 DCHECK(!scratch2().is(reg)); | 565 DCHECK(!scratch2().is(reg)); |
| 566 Handle<WeakCell> cell = | 566 Handle<WeakCell> cell = |
| 567 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 567 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 568 // The callback is alive if this instruction is executed, | 568 // The callback is alive if this instruction is executed, |
| 569 // so the weak cell is not cleared and points to data. | 569 // so the weak cell is not cleared and points to data. |
| 570 __ GetWeakValue(scratch2(), cell); | 570 __ GetWeakValue(scratch2(), scratch1(), cell); |
| 571 __ push(scratch2()); | 571 __ push(scratch2()); |
| 572 } | 572 } |
| 573 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue | 573 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
| 574 // ReturnValue default value | 574 // ReturnValue default value |
| 575 __ push(Immediate(isolate()->factory()->undefined_value())); | 575 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 576 __ push(Immediate(reinterpret_cast<int>(isolate()))); | 576 __ push(Immediate(reinterpret_cast<int>(isolate()))); |
| 577 __ push(reg); // holder | 577 __ push(reg); // holder |
| 578 | 578 |
| 579 // Save a pointer to where we pushed the arguments. This will be | 579 // Save a pointer to where we pushed the arguments. This will be |
| 580 // passed as the const PropertyAccessorInfo& to the C++ callback. | 580 // passed as the const PropertyAccessorInfo& to the C++ callback. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 733 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
| 734 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 734 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
| 735 Label miss; | 735 Label miss; |
| 736 if (IC::ICUseVector(kind())) { | 736 if (IC::ICUseVector(kind())) { |
| 737 PushVectorAndSlot(); | 737 PushVectorAndSlot(); |
| 738 } | 738 } |
| 739 FrontendHeader(receiver(), name, &miss); | 739 FrontendHeader(receiver(), name, &miss); |
| 740 // Get the value from the cell. | 740 // Get the value from the cell. |
| 741 Register result = StoreDescriptor::ValueRegister(); | 741 Register result = StoreDescriptor::ValueRegister(); |
| 742 Handle<WeakCell> weak_cell = factory()->NewWeakCell(cell); | 742 Handle<WeakCell> weak_cell = factory()->NewWeakCell(cell); |
| 743 __ LoadWeakValue(result, weak_cell, &miss); | 743 __ LoadWeakValue(result, weak_cell, scratch1(), &miss); |
| 744 __ mov(result, FieldOperand(result, PropertyCell::kValueOffset)); | 744 __ mov(result, FieldOperand(result, PropertyCell::kValueOffset)); |
| 745 | 745 |
| 746 // Check for deleted property if property can actually be deleted. | 746 // Check for deleted property if property can actually be deleted. |
| 747 if (is_configurable) { | 747 if (is_configurable) { |
| 748 __ cmp(result, factory()->the_hole_value()); | 748 __ cmp(result, factory()->the_hole_value()); |
| 749 __ j(equal, &miss); | 749 __ j(equal, &miss); |
| 750 } else if (FLAG_debug_code) { | 750 } else if (FLAG_debug_code) { |
| 751 __ cmp(result, factory()->the_hole_value()); | 751 __ cmp(result, factory()->the_hole_value()); |
| 752 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); | 752 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); |
| 753 } | 753 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 765 // Return the generated code. | 765 // Return the generated code. |
| 766 return GetCode(kind(), Code::NORMAL, name); | 766 return GetCode(kind(), Code::NORMAL, name); |
| 767 } | 767 } |
| 768 | 768 |
| 769 | 769 |
| 770 #undef __ | 770 #undef __ |
| 771 } | 771 } |
| 772 } // namespace v8::internal | 772 } // namespace v8::internal |
| 773 | 773 |
| 774 #endif // V8_TARGET_ARCH_IA32 | 774 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |