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

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

Issue 1255953002: MIPS: [stubs] Further optimize Load/StoreGlobalViaContext stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/mips/lithium-mips.cc ('k') | src/mips64/interface-descriptors-mips64.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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 5286 matching lines...) Expand 10 before | Expand all | Expand 10 after
5297 GenerateCase(masm, FAST_HOLEY_ELEMENTS); 5297 GenerateCase(masm, FAST_HOLEY_ELEMENTS);
5298 5298
5299 __ bind(&fast_elements_case); 5299 __ bind(&fast_elements_case);
5300 GenerateCase(masm, FAST_ELEMENTS); 5300 GenerateCase(masm, FAST_ELEMENTS);
5301 } 5301 }
5302 5302
5303 5303
5304 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { 5304 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
5305 Register context_reg = cp; 5305 Register context_reg = cp;
5306 Register slot_reg = a2; 5306 Register slot_reg = a2;
5307 Register name_reg = a3;
5308 Register result_reg = v0; 5307 Register result_reg = v0;
5309 Label slow_case; 5308 Label slow_case;
5310 5309
5311 // Go up context chain to the script context. 5310 // Go up context chain to the script context.
5312 for (int i = 0; i < depth(); ++i) { 5311 for (int i = 0; i < depth(); ++i) {
5313 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5312 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5314 context_reg = result_reg; 5313 context_reg = result_reg;
5315 } 5314 }
5316 5315
5317 // Load the PropertyCell value at the specified slot. 5316 // Load the PropertyCell value at the specified slot.
5318 __ dsll(at, slot_reg, kPointerSizeLog2); 5317 __ dsll(at, slot_reg, kPointerSizeLog2);
5319 __ Daddu(at, at, Operand(context_reg)); 5318 __ Daddu(at, at, Operand(context_reg));
5320 __ Daddu(at, at, Context::SlotOffset(0)); 5319 __ ld(result_reg, ContextOperand(at, 0));
5321 __ ld(result_reg, MemOperand(at));
5322 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); 5320 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset));
5323 5321
5324 // Check that value is not the_hole. 5322 // Check that value is not the_hole.
5325 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5323 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5326 __ Branch(&slow_case, eq, result_reg, Operand(at)); 5324 __ Branch(&slow_case, eq, result_reg, Operand(at));
5327 __ Ret(); 5325 __ Ret();
5328 5326
5329 // Fallback to the runtime. 5327 // Fallback to the runtime.
5330 __ bind(&slow_case); 5328 __ bind(&slow_case);
5331 __ SmiTag(slot_reg); 5329 __ SmiTag(slot_reg);
5332 __ Push(slot_reg, name_reg); 5330 __ Push(slot_reg);
5333 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); 5331 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
5334 } 5332 }
5335 5333
5336 5334
5337 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { 5335 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
5338 Register context_reg = cp; 5336 Register context_reg = cp;
5339 Register slot_reg = a2; 5337 Register slot_reg = a2;
5340 Register name_reg = a3;
5341 Register value_reg = a0; 5338 Register value_reg = a0;
5342 Register cell_reg = a4; 5339 Register cell_reg = a4;
5343 Register cell_details_reg = a5; 5340 Register cell_details_reg = a5;
5341 Register cell_value_reg = a3;
5344 Label fast_heapobject_case, fast_smi_case, slow_case; 5342 Label fast_heapobject_case, fast_smi_case, slow_case;
5345 5343
5346 if (FLAG_debug_code) { 5344 if (FLAG_debug_code) {
5347 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5345 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5348 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); 5346 __ Check(ne, kUnexpectedValue, value_reg, Operand(at));
5349 __ AssertName(name_reg);
5350 } 5347 }
5351 5348
5352 // Go up context chain to the script context. 5349 // Go up context chain to the script context.
5353 for (int i = 0; i < depth(); ++i) { 5350 for (int i = 0; i < depth(); ++i) {
5354 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5351 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5355 context_reg = cell_reg; 5352 context_reg = cell_reg;
5356 } 5353 }
5357 5354
5358 // Load the PropertyCell at the specified slot. 5355 // Load the PropertyCell at the specified slot.
5359 __ dsll(at, slot_reg, kPointerSizeLog2); 5356 __ dsll(at, slot_reg, kPointerSizeLog2);
5360 __ Daddu(at, at, Operand(context_reg)); 5357 __ Daddu(at, at, Operand(context_reg));
5361 __ Daddu(at, at, Context::SlotOffset(0)); 5358 __ ld(cell_reg, ContextOperand(at, 0));
5362 __ ld(cell_reg, MemOperand(at));
5363 5359
5364 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5360 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5365 __ ld(cell_details_reg, 5361 __ ld(cell_details_reg,
5366 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); 5362 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset));
5367 __ SmiUntag(cell_details_reg); 5363 __ SmiUntag(cell_details_reg);
5368 __ And(cell_details_reg, cell_details_reg, 5364 __ And(cell_details_reg, cell_details_reg,
5369 PropertyDetails::PropertyCellTypeField::kMask | 5365 PropertyDetails::PropertyCellTypeField::kMask |
5370 PropertyDetails::KindField::kMask); 5366 PropertyDetails::KindField::kMask);
5371 5367
5372 // Check if PropertyCell holds mutable data. 5368 // Check if PropertyCell holds mutable data.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 5410
5415 // Check if PropertyCell contains data with constant type. 5411 // Check if PropertyCell contains data with constant type.
5416 __ Branch(&slow_case, ne, cell_details_reg, 5412 __ Branch(&slow_case, ne, cell_details_reg,
5417 Operand(PropertyDetails::PropertyCellTypeField::encode( 5413 Operand(PropertyDetails::PropertyCellTypeField::encode(
5418 PropertyCellType::kConstantType) | 5414 PropertyCellType::kConstantType) |
5419 PropertyDetails::KindField::encode(kData))); 5415 PropertyDetails::KindField::encode(kData)));
5420 5416
5421 // Now either both old and new values must be SMIs or both must be heap 5417 // Now either both old and new values must be SMIs or both must be heap
5422 // objects with same map. 5418 // objects with same map.
5423 Label value_is_heap_object; 5419 Label value_is_heap_object;
5424 Register cell_value_reg = cell_details_reg;
5425 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); 5420 __ ld(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset));
5426 __ JumpIfNotSmi(value_reg, &value_is_heap_object); 5421 __ JumpIfNotSmi(value_reg, &value_is_heap_object);
5427 __ JumpIfNotSmi(cell_value_reg, &slow_case); 5422 __ JumpIfNotSmi(cell_value_reg, &slow_case);
5428 // Old and new values are SMIs, no need for a write barrier here. 5423 // Old and new values are SMIs, no need for a write barrier here.
5429 __ bind(&fast_smi_case); 5424 __ bind(&fast_smi_case);
5430 __ Ret(USE_DELAY_SLOT); 5425 __ Ret(USE_DELAY_SLOT);
5431 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset)); 5426 __ sd(value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset));
5432 __ bind(&value_is_heap_object); 5427 __ bind(&value_is_heap_object);
5433 __ JumpIfSmi(cell_value_reg, &slow_case); 5428 __ JumpIfSmi(cell_value_reg, &slow_case);
5434 Register cell_value_map_reg = cell_value_reg; 5429 Register cell_value_map_reg = cell_value_reg;
5435 __ ld(cell_value_map_reg, 5430 __ ld(cell_value_map_reg,
5436 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); 5431 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset));
5437 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, 5432 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg,
5438 FieldMemOperand(value_reg, HeapObject::kMapOffset)); 5433 FieldMemOperand(value_reg, HeapObject::kMapOffset));
5439 5434
5440 // Fallback to the runtime. 5435 // Fallback to the runtime.
5441 __ bind(&slow_case); 5436 __ bind(&slow_case);
5442 __ SmiTag(slot_reg); 5437 __ SmiTag(slot_reg);
5443 __ Push(slot_reg, name_reg, value_reg); 5438 __ Push(slot_reg, value_reg);
5444 __ TailCallRuntime(is_strict(language_mode()) 5439 __ TailCallRuntime(is_strict(language_mode())
5445 ? Runtime::kStoreGlobalViaContext_Strict 5440 ? Runtime::kStoreGlobalViaContext_Strict
5446 : Runtime::kStoreGlobalViaContext_Sloppy, 5441 : Runtime::kStoreGlobalViaContext_Sloppy,
5447 3, 1); 5442 2, 1);
5448 } 5443 }
5449 5444
5450 5445
5451 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 5446 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
5452 int64_t offset = (ref0.address() - ref1.address()); 5447 int64_t offset = (ref0.address() - ref1.address());
5453 DCHECK(static_cast<int>(offset) == offset); 5448 DCHECK(static_cast<int>(offset) == offset);
5454 return static_cast<int>(offset); 5449 return static_cast<int>(offset);
5455 } 5450 }
5456 5451
5457 5452
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
5751 MemOperand(fp, 6 * kPointerSize), NULL); 5746 MemOperand(fp, 6 * kPointerSize), NULL);
5752 } 5747 }
5753 5748
5754 5749
5755 #undef __ 5750 #undef __
5756 5751
5757 } // namespace internal 5752 } // namespace internal
5758 } // namespace v8 5753 } // namespace v8
5759 5754
5760 #endif // V8_TARGET_ARCH_MIPS64 5755 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698