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

Side by Side Diff: src/arm/code-stubs-arm.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 | « no previous file | src/arm/interface-descriptors-arm.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 4346 matching lines...) Expand 10 before | Expand all | Expand 10 after
4357 } 4357 }
4358 __ b(&done_allocate); 4358 __ b(&done_allocate);
4359 4359
4360 // Fall back to %NewStrictArguments. 4360 // Fall back to %NewStrictArguments.
4361 __ bind(&too_big_for_new_space); 4361 __ bind(&too_big_for_new_space);
4362 __ push(r1); 4362 __ push(r1);
4363 __ TailCallRuntime(Runtime::kNewStrictArguments); 4363 __ TailCallRuntime(Runtime::kNewStrictArguments);
4364 } 4364 }
4365 4365
4366 4366
4367 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
4368 Register value = r0;
4369 Register slot = r2;
4370
4371 Register cell = r1;
4372 Register cell_details = r4;
4373 Register cell_value = r5;
4374 Register cell_value_map = r6;
4375 Register scratch = r9;
4376
4377 Register context = cp;
4378 Register context_temp = cell;
4379
4380 Label fast_heapobject_case, fast_smi_case, slow_case;
4381
4382 if (FLAG_debug_code) {
4383 __ CompareRoot(value, Heap::kTheHoleValueRootIndex);
4384 __ Check(ne, kUnexpectedValue);
4385 }
4386
4387 // Go up the context chain to the script context.
4388 for (int i = 0; i < depth(); i++) {
4389 __ ldr(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX));
4390 context = context_temp;
4391 }
4392
4393 // Load the PropertyCell at the specified slot.
4394 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2));
4395 __ ldr(cell, ContextMemOperand(cell));
4396
4397 // Load PropertyDetails for the cell (actually only the cell_type and kind).
4398 __ ldr(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset));
4399 __ SmiUntag(cell_details);
4400 __ and_(cell_details, cell_details,
4401 Operand(PropertyDetails::PropertyCellTypeField::kMask |
4402 PropertyDetails::KindField::kMask |
4403 PropertyDetails::kAttributesReadOnlyMask));
4404
4405 // Check if PropertyCell holds mutable data.
4406 Label not_mutable_data;
4407 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
4408 PropertyCellType::kMutable) |
4409 PropertyDetails::KindField::encode(kData)));
4410 __ b(ne, &not_mutable_data);
4411 __ JumpIfSmi(value, &fast_smi_case);
4412
4413 __ bind(&fast_heapobject_case);
4414 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset));
4415 // RecordWriteField clobbers the value register, so we copy it before the
4416 // call.
4417 __ mov(r4, Operand(value));
4418 __ RecordWriteField(cell, PropertyCell::kValueOffset, r4, scratch,
4419 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
4420 OMIT_SMI_CHECK);
4421 __ Ret();
4422
4423 __ bind(&not_mutable_data);
4424 // Check if PropertyCell value matches the new value (relevant for Constant,
4425 // ConstantType and Undefined cells).
4426 Label not_same_value;
4427 __ ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
4428 __ cmp(cell_value, value);
4429 __ b(ne, &not_same_value);
4430
4431 // Make sure the PropertyCell is not marked READ_ONLY.
4432 __ tst(cell_details, Operand(PropertyDetails::kAttributesReadOnlyMask));
4433 __ b(ne, &slow_case);
4434
4435 if (FLAG_debug_code) {
4436 Label done;
4437 // This can only be true for Constant, ConstantType and Undefined cells,
4438 // because we never store the_hole via this stub.
4439 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
4440 PropertyCellType::kConstant) |
4441 PropertyDetails::KindField::encode(kData)));
4442 __ b(eq, &done);
4443 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
4444 PropertyCellType::kConstantType) |
4445 PropertyDetails::KindField::encode(kData)));
4446 __ b(eq, &done);
4447 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
4448 PropertyCellType::kUndefined) |
4449 PropertyDetails::KindField::encode(kData)));
4450 __ Check(eq, kUnexpectedValue);
4451 __ bind(&done);
4452 }
4453 __ Ret();
4454 __ bind(&not_same_value);
4455
4456 // Check if PropertyCell contains data with constant type (and is not
4457 // READ_ONLY).
4458 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
4459 PropertyCellType::kConstantType) |
4460 PropertyDetails::KindField::encode(kData)));
4461 __ b(ne, &slow_case);
4462
4463 // Now either both old and new values must be smis or both must be heap
4464 // objects with same map.
4465 Label value_is_heap_object;
4466 __ JumpIfNotSmi(value, &value_is_heap_object);
4467 __ JumpIfNotSmi(cell_value, &slow_case);
4468 // Old and new values are smis, no need for a write barrier here.
4469 __ bind(&fast_smi_case);
4470 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset));
4471 __ Ret();
4472
4473 __ bind(&value_is_heap_object);
4474 __ JumpIfSmi(cell_value, &slow_case);
4475
4476 __ ldr(cell_value_map, FieldMemOperand(cell_value, HeapObject::kMapOffset));
4477 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
4478 __ cmp(cell_value_map, scratch);
4479 __ b(eq, &fast_heapobject_case);
4480
4481 // Fallback to runtime.
4482 __ bind(&slow_case);
4483 __ SmiTag(slot);
4484 __ Push(slot, value);
4485 __ TailCallRuntime(is_strict(language_mode())
4486 ? Runtime::kStoreGlobalViaContext_Strict
4487 : Runtime::kStoreGlobalViaContext_Sloppy);
4488 }
4489
4490
4491 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 4367 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
4492 return ref0.address() - ref1.address(); 4368 return ref0.address() - ref1.address();
4493 } 4369 }
4494 4370
4495 4371
4496 // Calls an API function. Allocates HandleScope, extracts returned value 4372 // Calls an API function. Allocates HandleScope, extracts returned value
4497 // from handle and propagates exceptions. Restores context. stack_space 4373 // from handle and propagates exceptions. Restores context. stack_space
4498 // - space to be unwound on exit (includes the call JS arguments space and 4374 // - space to be unwound on exit (includes the call JS arguments space and
4499 // the additional space allocated for the fast call). 4375 // the additional space allocated for the fast call).
4500 static void CallApiFunctionAndReturn(MacroAssembler* masm, 4376 static void CallApiFunctionAndReturn(MacroAssembler* masm,
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
4796 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4672 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4797 kStackUnwindSpace, NULL, return_value_operand, NULL); 4673 kStackUnwindSpace, NULL, return_value_operand, NULL);
4798 } 4674 }
4799 4675
4800 #undef __ 4676 #undef __
4801 4677
4802 } // namespace internal 4678 } // namespace internal
4803 } // namespace v8 4679 } // namespace v8
4804 4680
4805 #endif // V8_TARGET_ARCH_ARM 4681 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698