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

Side by Side Diff: src/mips/code-stubs-mips.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 | « no previous file | src/mips64/code-stubs-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_MIPS 7 #if V8_TARGET_ARCH_MIPS
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 5267 matching lines...) Expand 10 before | Expand all | Expand 10 after
5278 Label slow_case; 5278 Label slow_case;
5279 5279
5280 // Go up context chain to the script context. 5280 // Go up context chain to the script context.
5281 for (int i = 0; i < depth(); ++i) { 5281 for (int i = 0; i < depth(); ++i) {
5282 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5282 __ lw(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5283 context_reg = result_reg; 5283 context_reg = result_reg;
5284 } 5284 }
5285 5285
5286 // Load the PropertyCell value at the specified slot. 5286 // Load the PropertyCell value at the specified slot.
5287 __ sll(at, slot_reg, kPointerSizeLog2); 5287 __ sll(at, slot_reg, kPointerSizeLog2);
5288 __ Addu(at, at, Operand(cp)); 5288 __ Addu(at, at, Operand(context_reg));
5289 __ Addu(at, at, Context::SlotOffset(0)); 5289 __ Addu(at, at, Context::SlotOffset(0));
5290 __ lw(result_reg, MemOperand(at)); 5290 __ lw(result_reg, MemOperand(at));
5291 __ lw(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset)); 5291 __ lw(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset));
5292 5292
5293 // Check that value is not the_hole. 5293 // Check that value is not the_hole.
5294 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5294 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5295 __ Branch(&slow_case, eq, result_reg, Operand(at)); 5295 __ Branch(&slow_case, eq, result_reg, Operand(at));
5296 __ Ret(); 5296 __ Ret();
5297 5297
5298 // Fallback to the runtime. 5298 // Fallback to the runtime.
5299 __ bind(&slow_case); 5299 __ bind(&slow_case);
5300 __ SmiTag(slot_reg); 5300 __ SmiTag(slot_reg);
5301 __ Drop(1); // Pop return address. 5301 __ Push(slot_reg, name_reg);
5302 __ Push(slot_reg, name_reg, result_reg);
5303 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1); 5302 __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
5304 } 5303 }
5305 5304
5306 5305
5307 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { 5306 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
5308 Register context_reg = cp; 5307 Register context_reg = cp;
5309 Register slot_reg = a2; 5308 Register slot_reg = a2;
5310 Register name_reg = a3; 5309 Register name_reg = a3;
5311 Register value_reg = a0; 5310 Register value_reg = a0;
5312 Register cell_reg = t0; 5311 Register cell_reg = t0;
5313 Register cell_details_reg = t1; 5312 Register cell_details_reg = t1;
5314 Label fast_heapobject_case, fast_smi_case, slow_case; 5313 Label fast_heapobject_case, fast_smi_case, slow_case;
5315 5314
5316 if (FLAG_debug_code) { 5315 if (FLAG_debug_code) {
5317 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5316 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5318 __ Check(ne, kUnexpectedValue, value_reg, Operand(at)); 5317 __ Check(ne, kUnexpectedValue, value_reg, Operand(at));
5319 __ AssertName(name_reg); 5318 __ AssertName(name_reg);
5320 } 5319 }
5321 5320
5322 // Go up context chain to the script context. 5321 // Go up context chain to the script context.
5323 for (int i = 0; i < depth(); ++i) { 5322 for (int i = 0; i < depth(); ++i) {
5324 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5323 __ lw(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5325 context_reg = cell_reg; 5324 context_reg = cell_reg;
5326 } 5325 }
5327 5326
5328 // Load the PropertyCell at the specified slot. 5327 // Load the PropertyCell at the specified slot.
5329 __ sll(at, slot_reg, kPointerSizeLog2); 5328 __ sll(at, slot_reg, kPointerSizeLog2);
5330 __ Addu(at, at, Operand(cp)); 5329 __ Addu(at, at, Operand(context_reg));
5331 __ Addu(at, at, Context::SlotOffset(0)); 5330 __ Addu(at, at, Context::SlotOffset(0));
5332 __ lw(cell_reg, MemOperand(at)); 5331 __ lw(cell_reg, MemOperand(at));
5333 5332
5334 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5333 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5335 __ lw(cell_details_reg, 5334 __ lw(cell_details_reg,
5336 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset)); 5335 FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset));
5337 __ SmiUntag(cell_details_reg); 5336 __ SmiUntag(cell_details_reg);
5338 __ And(cell_details_reg, cell_details_reg, 5337 __ And(cell_details_reg, cell_details_reg,
5339 PropertyDetails::PropertyCellTypeField::kMask | 5338 PropertyDetails::PropertyCellTypeField::kMask |
5340 PropertyDetails::KindField::kMask); 5339 PropertyDetails::KindField::kMask);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5403 __ JumpIfSmi(cell_value_reg, &slow_case); 5402 __ JumpIfSmi(cell_value_reg, &slow_case);
5404 Register cell_value_map_reg = cell_value_reg; 5403 Register cell_value_map_reg = cell_value_reg;
5405 __ lw(cell_value_map_reg, 5404 __ lw(cell_value_map_reg,
5406 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset)); 5405 FieldMemOperand(cell_value_reg, HeapObject::kMapOffset));
5407 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg, 5406 __ Branch(&fast_heapobject_case, eq, cell_value_map_reg,
5408 FieldMemOperand(value_reg, HeapObject::kMapOffset)); 5407 FieldMemOperand(value_reg, HeapObject::kMapOffset));
5409 5408
5410 // Fallback to the runtime. 5409 // Fallback to the runtime.
5411 __ bind(&slow_case); 5410 __ bind(&slow_case);
5412 __ SmiTag(slot_reg); 5411 __ SmiTag(slot_reg);
5413 __ Drop(1); // Pop return address. 5412 __ Push(slot_reg, name_reg, value_reg);
5414 __ Push(slot_reg, name_reg, value_reg, cell_reg);
5415 __ TailCallRuntime(is_strict(language_mode()) 5413 __ TailCallRuntime(is_strict(language_mode())
5416 ? Runtime::kStoreGlobalViaContext_Strict 5414 ? Runtime::kStoreGlobalViaContext_Strict
5417 : Runtime::kStoreGlobalViaContext_Sloppy, 5415 : Runtime::kStoreGlobalViaContext_Sloppy,
5418 3, 1); 5416 3, 1);
5419 } 5417 }
5420 5418
5421 5419
5422 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 5420 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
5423 return ref0.address() - ref1.address(); 5421 return ref0.address() - ref1.address();
5424 } 5422 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
5721 MemOperand(fp, 6 * kPointerSize), NULL); 5719 MemOperand(fp, 6 * kPointerSize), NULL);
5722 } 5720 }
5723 5721
5724 5722
5725 #undef __ 5723 #undef __
5726 5724
5727 } // namespace internal 5725 } // namespace internal
5728 } // namespace v8 5726 } // namespace v8
5729 5727
5730 #endif // V8_TARGET_ARCH_MIPS 5728 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698