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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 1259963002: [stubs] Don't pass name to Load/StoreGlobalViaContext stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix rebase Created 5 years, 4 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
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5112 GenerateCase(masm, FAST_HOLEY_ELEMENTS); 5112 GenerateCase(masm, FAST_HOLEY_ELEMENTS);
5113 5113
5114 __ bind(&fast_elements_case); 5114 __ bind(&fast_elements_case);
5115 GenerateCase(masm, FAST_ELEMENTS); 5115 GenerateCase(masm, FAST_ELEMENTS);
5116 } 5116 }
5117 5117
5118 5118
5119 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { 5119 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
5120 Register context_reg = esi; 5120 Register context_reg = esi;
5121 Register slot_reg = ebx; 5121 Register slot_reg = ebx;
5122 Register name_reg = ecx;
5123 Register result_reg = eax; 5122 Register result_reg = eax;
5124 Label slow_case; 5123 Label slow_case;
5125 5124
5126 // Go up context chain to the script context. 5125 // Go up context chain to the script context.
5127 for (int i = 0; i < depth(); ++i) { 5126 for (int i = 0; i < depth(); ++i) {
5128 __ mov(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5127 __ mov(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5129 context_reg = result_reg; 5128 context_reg = result_reg;
5130 } 5129 }
5131 5130
5132 // Load the PropertyCell value at the specified slot. 5131 // Load the PropertyCell value at the specified slot.
5133 __ mov(result_reg, ContextOperand(context_reg, slot_reg)); 5132 __ mov(result_reg, ContextOperand(context_reg, slot_reg));
5134 __ mov(result_reg, FieldOperand(result_reg, PropertyCell::kValueOffset)); 5133 __ mov(result_reg, FieldOperand(result_reg, PropertyCell::kValueOffset));
5135 5134
5136 // Check that value is not the_hole. 5135 // Check that value is not the_hole.
5137 __ CompareRoot(result_reg, Heap::kTheHoleValueRootIndex); 5136 __ CompareRoot(result_reg, Heap::kTheHoleValueRootIndex);
5138 __ j(equal, &slow_case, Label::kNear); 5137 __ j(equal, &slow_case, Label::kNear);
5139 __ Ret(); 5138 __ Ret();
5140 5139
5141 // Fallback to the runtime. 5140 // Fallback to the runtime.
5142 __ bind(&slow_case); 5141 __ bind(&slow_case);
5143 __ SmiTag(slot_reg); 5142 __ SmiTag(slot_reg);
5144 __ Pop(result_reg); // Pop return address. 5143 __ Pop(result_reg); // Pop return address.
5145 __ Push(slot_reg); 5144 __ Push(slot_reg);
5146 __ Push(name_reg);
5147 __ Push(result_reg); // Push return address. 5145 __ Push(result_reg); // Push return address.
5148 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); 5146 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
5149 } 5147 }
5150 5148
5151 5149
5152 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { 5150 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
5153 Register context_reg = esi; 5151 Register context_reg = esi;
5154 Register slot_reg = ebx; 5152 Register slot_reg = ebx;
5155 Register name_reg = ecx;
5156 Register value_reg = eax; 5153 Register value_reg = eax;
5157 Register cell_reg = edi; 5154 Register cell_reg = edi;
5158 Register cell_details_reg = edx; 5155 Register cell_details_reg = edx;
5156 Register cell_value_reg = ecx;
5159 Label fast_heapobject_case, fast_smi_case, slow_case; 5157 Label fast_heapobject_case, fast_smi_case, slow_case;
5160 5158
5161 if (FLAG_debug_code) { 5159 if (FLAG_debug_code) {
5162 __ CompareRoot(value_reg, Heap::kTheHoleValueRootIndex); 5160 __ CompareRoot(value_reg, Heap::kTheHoleValueRootIndex);
5163 __ Check(not_equal, kUnexpectedValue); 5161 __ Check(not_equal, kUnexpectedValue);
5164 __ AssertName(name_reg);
5165 } 5162 }
5166 5163
5167 // Go up context chain to the script context. 5164 // Go up context chain to the script context.
5168 for (int i = 0; i < depth(); ++i) { 5165 for (int i = 0; i < depth(); ++i) {
5169 __ mov(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5166 __ mov(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5170 context_reg = cell_reg; 5167 context_reg = cell_reg;
5171 } 5168 }
5172 5169
5173 // Load the PropertyCell at the specified slot. 5170 // Load the PropertyCell at the specified slot.
5174 __ mov(cell_reg, ContextOperand(context_reg, slot_reg)); 5171 __ mov(cell_reg, ContextOperand(context_reg, slot_reg));
(...skipping 21 matching lines...) Expand all
5196 cell_details_reg, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 5193 cell_details_reg, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
5197 OMIT_SMI_CHECK); 5194 OMIT_SMI_CHECK);
5198 // RecordWriteField clobbers the value register, so we need to reload. 5195 // RecordWriteField clobbers the value register, so we need to reload.
5199 __ mov(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); 5196 __ mov(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
5200 __ Ret(); 5197 __ Ret();
5201 __ bind(&not_mutable_data); 5198 __ bind(&not_mutable_data);
5202 5199
5203 // Check if PropertyCell value matches the new value (relevant for Constant, 5200 // Check if PropertyCell value matches the new value (relevant for Constant,
5204 // ConstantType and Undefined cells). 5201 // ConstantType and Undefined cells).
5205 Label not_same_value; 5202 Label not_same_value;
5206 __ cmp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); 5203 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
5204 __ cmp(cell_value_reg, value_reg);
5207 __ j(not_equal, &not_same_value, 5205 __ j(not_equal, &not_same_value,
5208 FLAG_debug_code ? Label::kFar : Label::kNear); 5206 FLAG_debug_code ? Label::kFar : Label::kNear);
5209 // Make sure the PropertyCell is not marked READ_ONLY. 5207 // Make sure the PropertyCell is not marked READ_ONLY.
5210 __ test(cell_details_reg, 5208 __ test(cell_details_reg,
5211 Immediate(PropertyDetails::kAttributesReadOnlyMask)); 5209 Immediate(PropertyDetails::kAttributesReadOnlyMask));
5212 __ j(not_zero, &slow_case); 5210 __ j(not_zero, &slow_case);
5213 if (FLAG_debug_code) { 5211 if (FLAG_debug_code) {
5214 Label done; 5212 Label done;
5215 // This can only be true for Constant, ConstantType and Undefined cells, 5213 // This can only be true for Constant, ConstantType and Undefined cells,
5216 // because we never store the_hole via this stub. 5214 // because we never store the_hole via this stub.
(...skipping 21 matching lines...) Expand all
5238 // READ_ONLY). 5236 // READ_ONLY).
5239 __ cmp(cell_details_reg, 5237 __ cmp(cell_details_reg,
5240 Immediate(PropertyDetails::PropertyCellTypeField::encode( 5238 Immediate(PropertyDetails::PropertyCellTypeField::encode(
5241 PropertyCellType::kConstantType) | 5239 PropertyCellType::kConstantType) |
5242 PropertyDetails::KindField::encode(kData))); 5240 PropertyDetails::KindField::encode(kData)));
5243 __ j(not_equal, &slow_case, Label::kNear); 5241 __ j(not_equal, &slow_case, Label::kNear);
5244 5242
5245 // Now either both old and new values must be SMIs or both must be heap 5243 // Now either both old and new values must be SMIs or both must be heap
5246 // objects with same map. 5244 // objects with same map.
5247 Label value_is_heap_object; 5245 Label value_is_heap_object;
5248 // TODO(bmeurer): use ecx (name_reg) when name parameter is removed.
5249 Register cell_value_reg = cell_details_reg;
5250 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
5251 __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear); 5246 __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear);
5252 __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear); 5247 __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear);
5253 // Old and new values are SMIs, no need for a write barrier here. 5248 // Old and new values are SMIs, no need for a write barrier here.
5254 __ bind(&fast_smi_case); 5249 __ bind(&fast_smi_case);
5255 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg); 5250 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg);
5256 __ Ret(); 5251 __ Ret();
5257 __ bind(&value_is_heap_object); 5252 __ bind(&value_is_heap_object);
5258 __ JumpIfSmi(cell_value_reg, &slow_case, Label::kNear); 5253 __ JumpIfSmi(cell_value_reg, &slow_case, Label::kNear);
5259 Register cell_value_map_reg = cell_value_reg; 5254 Register cell_value_map_reg = cell_value_reg;
5260 __ mov(cell_value_map_reg, 5255 __ mov(cell_value_map_reg,
5261 FieldOperand(cell_value_reg, HeapObject::kMapOffset)); 5256 FieldOperand(cell_value_reg, HeapObject::kMapOffset));
5262 __ cmp(cell_value_map_reg, FieldOperand(value_reg, HeapObject::kMapOffset)); 5257 __ cmp(cell_value_map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
5263 __ j(equal, &fast_heapobject_case); 5258 __ j(equal, &fast_heapobject_case);
5264 5259
5265 // Fallback to the runtime. 5260 // Fallback to the runtime.
5266 __ bind(&slow_case); 5261 __ bind(&slow_case);
5267 __ SmiTag(slot_reg); 5262 __ SmiTag(slot_reg);
5268 __ Pop(cell_reg); // Pop return address. 5263 __ Pop(cell_reg); // Pop return address.
5269 __ Push(slot_reg); 5264 __ Push(slot_reg);
5270 __ Push(name_reg);
5271 __ Push(value_reg); 5265 __ Push(value_reg);
5272 __ Push(cell_reg); // Push return address. 5266 __ Push(cell_reg); // Push return address.
5273 __ TailCallRuntime(is_strict(language_mode()) 5267 __ TailCallRuntime(is_strict(language_mode())
5274 ? Runtime::kStoreGlobalViaContext_Strict 5268 ? Runtime::kStoreGlobalViaContext_Strict
5275 : Runtime::kStoreGlobalViaContext_Sloppy, 5269 : Runtime::kStoreGlobalViaContext_Sloppy,
5276 3, 1); 5270 2, 1);
5277 } 5271 }
5278 5272
5279 5273
5280 // Generates an Operand for saving parameters after PrepareCallApiFunction. 5274 // Generates an Operand for saving parameters after PrepareCallApiFunction.
5281 static Operand ApiParameterOperand(int index) { 5275 static Operand ApiParameterOperand(int index) {
5282 return Operand(esp, index * kPointerSize); 5276 return Operand(esp, index * kPointerSize);
5283 } 5277 }
5284 5278
5285 5279
5286 // Prepares stack to put arguments (aligns and so on). Reserves 5280 // Prepares stack to put arguments (aligns and so on). Reserves
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5660 Operand(ebp, 7 * kPointerSize), NULL); 5654 Operand(ebp, 7 * kPointerSize), NULL);
5661 } 5655 }
5662 5656
5663 5657
5664 #undef __ 5658 #undef __
5665 5659
5666 } // namespace internal 5660 } // namespace internal
5667 } // namespace v8 5661 } // namespace v8
5668 5662
5669 #endif // V8_TARGET_ARCH_IA32 5663 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698