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

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

Issue 1257603004: [mips] Fix Load/StoreGlobalContext 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/code-stubs-mips.cc ('k') | no next file » | 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 5298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5309 Label slow_case; 5309 Label slow_case;
5310 5310
5311 // Go up context chain to the script context. 5311 // Go up context chain to the script context.
5312 for (int i = 0; i < depth(); ++i) { 5312 for (int i = 0; i < depth(); ++i) {
5313 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5313 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5314 context_reg = result_reg; 5314 context_reg = result_reg;
5315 } 5315 }
5316 5316
5317 // Load the PropertyCell value at the specified slot. 5317 // Load the PropertyCell value at the specified slot.
5318 __ dsll(at, slot_reg, kPointerSizeLog2); 5318 __ dsll(at, slot_reg, kPointerSizeLog2);
5319 __ Daddu(at, at, Operand(cp)); 5319 __ Daddu(at, at, Operand(context_reg));
5320 __ Daddu(at, at, Context::SlotOffset(0)); 5320 __ Daddu(at, at, Context::SlotOffset(0));
5321 __ ld(result_reg, MemOperand(at)); 5321 __ ld(result_reg, MemOperand(at));
5322 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); 5322 __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset));
5323 5323
5324 // Check that value is not the_hole. 5324 // Check that value is not the_hole.
5325 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5325 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5326 __ Branch(&slow_case, eq, result_reg, Operand(at)); 5326 __ Branch(&slow_case, eq, result_reg, Operand(at));
5327 __ Ret(); 5327 __ Ret();
5328 5328
5329 // Fallback to the runtime. 5329 // Fallback to the runtime.
5330 __ bind(&slow_case); 5330 __ bind(&slow_case);
5331 __ SmiTag(slot_reg); 5331 __ SmiTag(slot_reg);
5332 __ Drop(1); // Pop return address. 5332 __ Push(slot_reg, name_reg);
5333 __ Push(slot_reg, name_reg, result_reg);
5334 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); 5333 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
5335 } 5334 }
5336 5335
5337 5336
5338 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { 5337 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
5339 Register context_reg = cp; 5338 Register context_reg = cp;
5340 Register slot_reg = a2; 5339 Register slot_reg = a2;
5341 Register name_reg = a3; 5340 Register name_reg = a3;
5342 Register value_reg = a0; 5341 Register value_reg = a0;
5343 Register cell_reg = a4; 5342 Register cell_reg = a4;
5344 Register cell_details_reg = a5; 5343 Register cell_details_reg = a5;
5345 Label fast_heapobject_case, fast_smi_case, slow_case; 5344 Label fast_heapobject_case, fast_smi_case, slow_case;
5346 5345
5347 if (FLAG_debug_code) { 5346 if (FLAG_debug_code) {
5348 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5347 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5349 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); 5348 __ Check(ne, kUnexpectedValue, value_reg, Operand(at));
5350 __ AssertName(name_reg); 5349 __ AssertName(name_reg);
5351 } 5350 }
5352 5351
5353 // Go up context chain to the script context. 5352 // Go up context chain to the script context.
5354 for (int i = 0; i < depth(); ++i) { 5353 for (int i = 0; i < depth(); ++i) {
5355 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5354 __ ld(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5356 context_reg = cell_reg; 5355 context_reg = cell_reg;
5357 } 5356 }
5358 5357
5359 // Load the PropertyCell at the specified slot. 5358 // Load the PropertyCell at the specified slot.
5360 __ dsll(at, slot_reg, kPointerSizeLog2); 5359 __ dsll(at, slot_reg, kPointerSizeLog2);
5361 __ Daddu(at, at, Operand(cp)); 5360 __ Daddu(at, at, Operand(context_reg));
5362 __ Daddu(at, at, Context::SlotOffset(0)); 5361 __ Daddu(at, at, Context::SlotOffset(0));
5363 __ ld(cell_reg, MemOperand(at)); 5362 __ ld(cell_reg, MemOperand(at));
5364 5363
5365 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5364 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5366 __ ld(cell_details_reg, 5365 __ ld(cell_details_reg,
5367 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); 5366 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset));
5368 __ SmiUntag(cell_details_reg); 5367 __ SmiUntag(cell_details_reg);
5369 __ And(cell_details_reg, cell_details_reg, 5368 __ And(cell_details_reg, cell_details_reg,
5370 PropertyDetails::PropertyCellTypeField::kMask | 5369 PropertyDetails::PropertyCellTypeField::kMask |
5371 PropertyDetails::KindField::kMask); 5370 PropertyDetails::KindField::kMask);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 __ JumpIfSmi(cell_value_reg, &slow_case); 5433 __ JumpIfSmi(cell_value_reg, &slow_case);
5435 Register cell_value_map_reg = cell_value_reg; 5434 Register cell_value_map_reg = cell_value_reg;
5436 __ ld(cell_value_map_reg, 5435 __ ld(cell_value_map_reg,
5437 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); 5436 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset));
5438 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, 5437 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg,
5439 FieldMemOperand(value_reg, HeapObject::kMapOffset)); 5438 FieldMemOperand(value_reg, HeapObject::kMapOffset));
5440 5439
5441 // Fallback to the runtime. 5440 // Fallback to the runtime.
5442 __ bind(&slow_case); 5441 __ bind(&slow_case);
5443 __ SmiTag(slot_reg); 5442 __ SmiTag(slot_reg);
5444 __ Drop(1); // Pop return address. 5443 __ Push(slot_reg, name_reg, value_reg);
5445 __ Push(slot_reg, name_reg, value_reg, cell_reg);
5446 __ TailCallRuntime(is_strict(language_mode()) 5444 __ TailCallRuntime(is_strict(language_mode())
5447 ? Runtime::kStoreGlobalViaContext_Strict 5445 ? Runtime::kStoreGlobalViaContext_Strict
5448 : Runtime::kStoreGlobalViaContext_Sloppy, 5446 : Runtime::kStoreGlobalViaContext_Sloppy,
5449 3, 1); 5447 3, 1);
5450 } 5448 }
5451 5449
5452 5450
5453 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 5451 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
5454 int64_t offset = (ref0.address() - ref1.address()); 5452 int64_t offset = (ref0.address() - ref1.address());
5455 DCHECK(static_cast<int>(offset) == offset); 5453 DCHECK(static_cast<int>(offset) == offset);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 MemOperand(fp, 6 * kPointerSize), NULL); 5751 MemOperand(fp, 6 * kPointerSize), NULL);
5754 } 5752 }
5755 5753
5756 5754
5757 #undef __ 5755 #undef __
5758 5756
5759 } // namespace internal 5757 } // namespace internal
5760 } // namespace v8 5758 } // namespace v8
5761 5759
5762 #endif // V8_TARGET_ARCH_MIPS64 5760 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698