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

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

Issue 2412613004: [stubs] Remove unused StoreGlobalViaContextStub. (Closed)
Patch Set: Created 4 years, 2 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/x64/interface-descriptors-x64.cc ('k') | src/x87/interface-descriptors-x87.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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4365 // JavaScript frame for the function. 4365 // JavaScript frame for the function.
4366 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 4366 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
4367 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset)); 4367 __ Push(Operand(edx, StandardFrameConstants::kFunctionOffset));
4368 } else { 4368 } else {
4369 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset)); 4369 __ Push(Operand(ebp, StandardFrameConstants::kFunctionOffset));
4370 } 4370 }
4371 __ PushReturnAddressFrom(ecx); 4371 __ PushReturnAddressFrom(ecx);
4372 __ TailCallRuntime(Runtime::kNewStrictArguments); 4372 __ TailCallRuntime(Runtime::kNewStrictArguments);
4373 } 4373 }
4374 4374
4375 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
4376 Register context_reg = esi;
4377 Register slot_reg = ebx;
4378 Register value_reg = eax;
4379 Register cell_reg = edi;
4380 Register cell_details_reg = edx;
4381 Register cell_value_reg = ecx;
4382 Label fast_heapobject_case, fast_smi_case, slow_case;
4383
4384 if (FLAG_debug_code) {
4385 __ CompareRoot(value_reg, Heap::kTheHoleValueRootIndex);
4386 __ Check(not_equal, kUnexpectedValue);
4387 }
4388
4389 // Go up context chain to the script context.
4390 for (int i = 0; i < depth(); ++i) {
4391 __ mov(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
4392 context_reg = cell_reg;
4393 }
4394
4395 // Load the PropertyCell at the specified slot.
4396 __ mov(cell_reg, ContextOperand(context_reg, slot_reg));
4397
4398 // Load PropertyDetails for the cell (actually only the cell_type and kind).
4399 __ mov(cell_details_reg,
4400 FieldOperand(cell_reg, PropertyCell::kDetailsOffset));
4401 __ SmiUntag(cell_details_reg);
4402 __ and_(cell_details_reg,
4403 Immediate(PropertyDetails::PropertyCellTypeField::kMask |
4404 PropertyDetails::KindField::kMask |
4405 PropertyDetails::kAttributesReadOnlyMask));
4406
4407 // Check if PropertyCell holds mutable data.
4408 Label not_mutable_data;
4409 __ cmp(cell_details_reg,
4410 Immediate(PropertyDetails::PropertyCellTypeField::encode(
4411 PropertyCellType::kMutable) |
4412 PropertyDetails::KindField::encode(kData)));
4413 __ j(not_equal, &not_mutable_data);
4414 __ JumpIfSmi(value_reg, &fast_smi_case);
4415 __ bind(&fast_heapobject_case);
4416 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg);
4417 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg,
4418 cell_details_reg, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
4419 OMIT_SMI_CHECK);
4420 // RecordWriteField clobbers the value register, so we need to reload.
4421 __ mov(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
4422 __ Ret();
4423 __ bind(&not_mutable_data);
4424
4425 // Check if PropertyCell value matches the new value (relevant for Constant,
4426 // ConstantType and Undefined cells).
4427 Label not_same_value;
4428 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
4429 __ cmp(cell_value_reg, value_reg);
4430 __ j(not_equal, &not_same_value,
4431 FLAG_debug_code ? Label::kFar : Label::kNear);
4432 // Make sure the PropertyCell is not marked READ_ONLY.
4433 __ test(cell_details_reg,
4434 Immediate(PropertyDetails::kAttributesReadOnlyMask));
4435 __ j(not_zero, &slow_case);
4436 if (FLAG_debug_code) {
4437 Label done;
4438 // This can only be true for Constant, ConstantType and Undefined cells,
4439 // because we never store the_hole via this stub.
4440 __ cmp(cell_details_reg,
4441 Immediate(PropertyDetails::PropertyCellTypeField::encode(
4442 PropertyCellType::kConstant) |
4443 PropertyDetails::KindField::encode(kData)));
4444 __ j(equal, &done);
4445 __ cmp(cell_details_reg,
4446 Immediate(PropertyDetails::PropertyCellTypeField::encode(
4447 PropertyCellType::kConstantType) |
4448 PropertyDetails::KindField::encode(kData)));
4449 __ j(equal, &done);
4450 __ cmp(cell_details_reg,
4451 Immediate(PropertyDetails::PropertyCellTypeField::encode(
4452 PropertyCellType::kUndefined) |
4453 PropertyDetails::KindField::encode(kData)));
4454 __ Check(equal, kUnexpectedValue);
4455 __ bind(&done);
4456 }
4457 __ Ret();
4458 __ bind(&not_same_value);
4459
4460 // Check if PropertyCell contains data with constant type (and is not
4461 // READ_ONLY).
4462 __ cmp(cell_details_reg,
4463 Immediate(PropertyDetails::PropertyCellTypeField::encode(
4464 PropertyCellType::kConstantType) |
4465 PropertyDetails::KindField::encode(kData)));
4466 __ j(not_equal, &slow_case, Label::kNear);
4467
4468 // Now either both old and new values must be SMIs or both must be heap
4469 // objects with same map.
4470 Label value_is_heap_object;
4471 __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear);
4472 __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear);
4473 // Old and new values are SMIs, no need for a write barrier here.
4474 __ bind(&fast_smi_case);
4475 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg);
4476 __ Ret();
4477 __ bind(&value_is_heap_object);
4478 __ JumpIfSmi(cell_value_reg, &slow_case, Label::kNear);
4479 Register cell_value_map_reg = cell_value_reg;
4480 __ mov(cell_value_map_reg,
4481 FieldOperand(cell_value_reg, HeapObject::kMapOffset));
4482 __ cmp(cell_value_map_reg, FieldOperand(value_reg, HeapObject::kMapOffset));
4483 __ j(equal, &fast_heapobject_case);
4484
4485 // Fallback to the runtime.
4486 __ bind(&slow_case);
4487 __ SmiTag(slot_reg);
4488 __ Pop(cell_reg); // Pop return address.
4489 __ Push(slot_reg);
4490 __ Push(value_reg);
4491 __ Push(cell_reg); // Push return address.
4492 __ TailCallRuntime(is_strict(language_mode())
4493 ? Runtime::kStoreGlobalViaContext_Strict
4494 : Runtime::kStoreGlobalViaContext_Sloppy);
4495 }
4496
4497
4498 // Generates an Operand for saving parameters after PrepareCallApiFunction. 4375 // Generates an Operand for saving parameters after PrepareCallApiFunction.
4499 static Operand ApiParameterOperand(int index) { 4376 static Operand ApiParameterOperand(int index) {
4500 return Operand(esp, index * kPointerSize); 4377 return Operand(esp, index * kPointerSize);
4501 } 4378 }
4502 4379
4503 4380
4504 // Prepares stack to put arguments (aligns and so on). Reserves 4381 // Prepares stack to put arguments (aligns and so on). Reserves
4505 // space for return value if needed (assumes the return value is a handle). 4382 // space for return value if needed (assumes the return value is a handle).
4506 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1) 4383 // Arguments must be stored in ApiParameterOperand(0), ApiParameterOperand(1)
4507 // etc. Saves context (esi). If space was reserved for return value then 4384 // etc. Saves context (esi). If space was reserved for return value then
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4872 kStackUnwindSpace, nullptr, return_value_operand, 4749 kStackUnwindSpace, nullptr, return_value_operand,
4873 NULL); 4750 NULL);
4874 } 4751 }
4875 4752
4876 #undef __ 4753 #undef __
4877 4754
4878 } // namespace internal 4755 } // namespace internal
4879 } // namespace v8 4756 } // namespace v8
4880 4757
4881 #endif // V8_TARGET_ARCH_X87 4758 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/interface-descriptors-x64.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698