| Index: src/ic/arm/ic-compiler-arm.cc
|
| diff --git a/src/arm/stub-cache-arm.cc b/src/ic/arm/ic-compiler-arm.cc
|
| similarity index 78%
|
| rename from src/arm/stub-cache-arm.cc
|
| rename to src/ic/arm/ic-compiler-arm.cc
|
| index b8704037894a5cf09650635627a0cb16ba554d30..2c6df44ba82fe68e4db32ff3aa79d1a38372a7b9 100644
|
| --- a/src/arm/stub-cache-arm.cc
|
| +++ b/src/ic/arm/ic-compiler-arm.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2012 the V8 project authors. All rights reserved.
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -6,9 +6,7 @@
|
|
|
| #if V8_TARGET_ARCH_ARM
|
|
|
| -#include "src/codegen.h"
|
| -#include "src/ic-inl.h"
|
| -#include "src/stub-cache.h"
|
| +#include "src/ic/ic-compiler.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -16,88 +14,6 @@ namespace internal {
|
| #define __ ACCESS_MASM(masm)
|
|
|
|
|
| -static void ProbeTable(Isolate* isolate,
|
| - MacroAssembler* masm,
|
| - Code::Flags flags,
|
| - StubCache::Table table,
|
| - Register receiver,
|
| - Register name,
|
| - // Number of the cache entry, not scaled.
|
| - Register offset,
|
| - Register scratch,
|
| - Register scratch2,
|
| - Register offset_scratch) {
|
| - ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
|
| - ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
|
| - ExternalReference map_offset(isolate->stub_cache()->map_reference(table));
|
| -
|
| - uint32_t key_off_addr = reinterpret_cast<uint32_t>(key_offset.address());
|
| - uint32_t value_off_addr = reinterpret_cast<uint32_t>(value_offset.address());
|
| - uint32_t map_off_addr = reinterpret_cast<uint32_t>(map_offset.address());
|
| -
|
| - // Check the relative positions of the address fields.
|
| - DCHECK(value_off_addr > key_off_addr);
|
| - DCHECK((value_off_addr - key_off_addr) % 4 == 0);
|
| - DCHECK((value_off_addr - key_off_addr) < (256 * 4));
|
| - DCHECK(map_off_addr > key_off_addr);
|
| - DCHECK((map_off_addr - key_off_addr) % 4 == 0);
|
| - DCHECK((map_off_addr - key_off_addr) < (256 * 4));
|
| -
|
| - Label miss;
|
| - Register base_addr = scratch;
|
| - scratch = no_reg;
|
| -
|
| - // Multiply by 3 because there are 3 fields per entry (name, code, map).
|
| - __ add(offset_scratch, offset, Operand(offset, LSL, 1));
|
| -
|
| - // Calculate the base address of the entry.
|
| - __ mov(base_addr, Operand(key_offset));
|
| - __ add(base_addr, base_addr, Operand(offset_scratch, LSL, kPointerSizeLog2));
|
| -
|
| - // Check that the key in the entry matches the name.
|
| - __ ldr(ip, MemOperand(base_addr, 0));
|
| - __ cmp(name, ip);
|
| - __ b(ne, &miss);
|
| -
|
| - // Check the map matches.
|
| - __ ldr(ip, MemOperand(base_addr, map_off_addr - key_off_addr));
|
| - __ ldr(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ cmp(ip, scratch2);
|
| - __ b(ne, &miss);
|
| -
|
| - // Get the code entry from the cache.
|
| - Register code = scratch2;
|
| - scratch2 = no_reg;
|
| - __ ldr(code, MemOperand(base_addr, value_off_addr - key_off_addr));
|
| -
|
| - // Check that the flags match what we're looking for.
|
| - Register flags_reg = base_addr;
|
| - base_addr = no_reg;
|
| - __ ldr(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
|
| - // It's a nice optimization if this constant is encodable in the bic insn.
|
| -
|
| - uint32_t mask = Code::kFlagsNotUsedInLookup;
|
| - DCHECK(__ ImmediateFitsAddrMode1Instruction(mask));
|
| - __ bic(flags_reg, flags_reg, Operand(mask));
|
| - __ cmp(flags_reg, Operand(flags));
|
| - __ b(ne, &miss);
|
| -
|
| -#ifdef DEBUG
|
| - if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
|
| - __ jmp(&miss);
|
| - } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) {
|
| - __ jmp(&miss);
|
| - }
|
| -#endif
|
| -
|
| - // Jump to the first instruction in the code stub.
|
| - __ add(pc, code, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Miss: fall through.
|
| - __ bind(&miss);
|
| -}
|
| -
|
| -
|
| void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
|
| MacroAssembler* masm, Label* miss_label, Register receiver,
|
| Handle<Name> name, Register scratch0, Register scratch1) {
|
| @@ -138,112 +54,13 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
|
| __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
|
|
|
|
|
| - NameDictionaryLookupStub::GenerateNegativeLookup(masm,
|
| - miss_label,
|
| - &done,
|
| - receiver,
|
| - properties,
|
| - name,
|
| - scratch1);
|
| + NameDictionaryLookupStub::GenerateNegativeLookup(
|
| + masm, miss_label, &done, receiver, properties, name, scratch1);
|
| __ bind(&done);
|
| __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
|
| }
|
|
|
|
|
| -void StubCache::GenerateProbe(MacroAssembler* masm,
|
| - Code::Flags flags,
|
| - Register receiver,
|
| - Register name,
|
| - Register scratch,
|
| - Register extra,
|
| - Register extra2,
|
| - Register extra3) {
|
| - Isolate* isolate = masm->isolate();
|
| - Label miss;
|
| -
|
| - // Make sure that code is valid. The multiplying code relies on the
|
| - // entry size being 12.
|
| - DCHECK(sizeof(Entry) == 12);
|
| -
|
| - // Make sure the flags does not name a specific type.
|
| - DCHECK(Code::ExtractTypeFromFlags(flags) == 0);
|
| -
|
| - // Make sure that there are no register conflicts.
|
| - DCHECK(!scratch.is(receiver));
|
| - DCHECK(!scratch.is(name));
|
| - DCHECK(!extra.is(receiver));
|
| - DCHECK(!extra.is(name));
|
| - DCHECK(!extra.is(scratch));
|
| - DCHECK(!extra2.is(receiver));
|
| - DCHECK(!extra2.is(name));
|
| - DCHECK(!extra2.is(scratch));
|
| - DCHECK(!extra2.is(extra));
|
| -
|
| - // Check scratch, extra and extra2 registers are valid.
|
| - DCHECK(!scratch.is(no_reg));
|
| - DCHECK(!extra.is(no_reg));
|
| - DCHECK(!extra2.is(no_reg));
|
| - DCHECK(!extra3.is(no_reg));
|
| -
|
| - Counters* counters = masm->isolate()->counters();
|
| - __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1,
|
| - extra2, extra3);
|
| -
|
| - // Check that the receiver isn't a smi.
|
| - __ JumpIfSmi(receiver, &miss);
|
| -
|
| - // Get the map of the receiver and compute the hash.
|
| - __ ldr(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
|
| - __ ldr(ip, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ add(scratch, scratch, Operand(ip));
|
| - uint32_t mask = kPrimaryTableSize - 1;
|
| - // We shift out the last two bits because they are not part of the hash and
|
| - // they are always 01 for maps.
|
| - __ mov(scratch, Operand(scratch, LSR, kCacheIndexShift));
|
| - // Mask down the eor argument to the minimum to keep the immediate
|
| - // ARM-encodable.
|
| - __ eor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
|
| - // Prefer and_ to ubfx here because ubfx takes 2 cycles.
|
| - __ and_(scratch, scratch, Operand(mask));
|
| -
|
| - // Probe the primary table.
|
| - ProbeTable(isolate,
|
| - masm,
|
| - flags,
|
| - kPrimary,
|
| - receiver,
|
| - name,
|
| - scratch,
|
| - extra,
|
| - extra2,
|
| - extra3);
|
| -
|
| - // Primary miss: Compute hash for secondary probe.
|
| - __ sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift));
|
| - uint32_t mask2 = kSecondaryTableSize - 1;
|
| - __ add(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
|
| - __ and_(scratch, scratch, Operand(mask2));
|
| -
|
| - // Probe the secondary table.
|
| - ProbeTable(isolate,
|
| - masm,
|
| - flags,
|
| - kSecondary,
|
| - receiver,
|
| - name,
|
| - scratch,
|
| - extra,
|
| - extra2,
|
| - extra3);
|
| -
|
| - // Cache miss: Fall-through and let caller handle the miss by
|
| - // entering the runtime system.
|
| - __ bind(&miss);
|
| - __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1,
|
| - extra2, extra3);
|
| -}
|
| -
|
| -
|
| void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
|
| MacroAssembler* masm, int index, Register prototype, Label* miss) {
|
| Isolate* isolate = masm->isolate();
|
| @@ -466,8 +283,8 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
|
| __ jmp(&do_store);
|
|
|
| __ bind(&heap_number);
|
| - __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex,
|
| - miss_label, DONT_DO_SMI_CHECK);
|
| + __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, miss_label,
|
| + DONT_DO_SMI_CHECK);
|
| __ vldr(d0, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
|
|
|
| __ bind(&do_store);
|
| @@ -497,13 +314,8 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
|
| __ str(scratch1, FieldMemOperand(receiver_reg, HeapObject::kMapOffset));
|
|
|
| // Update the write barrier for the map field.
|
| - __ RecordWriteField(receiver_reg,
|
| - HeapObject::kMapOffset,
|
| - scratch1,
|
| - scratch2,
|
| - kLRHasNotBeenSaved,
|
| - kDontSaveFPRegs,
|
| - OMIT_REMEMBERED_SET,
|
| + __ RecordWriteField(receiver_reg, HeapObject::kMapOffset, scratch1, scratch2,
|
| + kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
|
|
| if (details.type() == CONSTANT) {
|
| @@ -521,8 +333,8 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
|
| index -= transition->inobject_properties();
|
|
|
| // TODO(verwaest): Share this code as a code stub.
|
| - SmiCheck smi_check = representation.IsTagged()
|
| - ? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
|
| + SmiCheck smi_check =
|
| + representation.IsTagged() ? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
|
| if (index < 0) {
|
| // Set the property straight into the object.
|
| int offset = transition->instance_size() + (index * kPointerSize);
|
| @@ -537,14 +349,9 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
|
| if (!representation.IsDouble()) {
|
| __ mov(storage_reg, value_reg);
|
| }
|
| - __ RecordWriteField(receiver_reg,
|
| - offset,
|
| - storage_reg,
|
| - scratch1,
|
| - kLRHasNotBeenSaved,
|
| - kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| - smi_check);
|
| + __ RecordWriteField(receiver_reg, offset, storage_reg, scratch1,
|
| + kLRHasNotBeenSaved, kDontSaveFPRegs,
|
| + EMIT_REMEMBERED_SET, smi_check);
|
| }
|
| } else {
|
| // Write to the properties array.
|
| @@ -563,14 +370,9 @@ void NamedStoreHandlerCompiler::GenerateStoreTransition(
|
| if (!representation.IsDouble()) {
|
| __ mov(storage_reg, value_reg);
|
| }
|
| - __ RecordWriteField(scratch1,
|
| - offset,
|
| - storage_reg,
|
| - receiver_reg,
|
| - kLRHasNotBeenSaved,
|
| - kDontSaveFPRegs,
|
| - EMIT_REMEMBERED_SET,
|
| - smi_check);
|
| + __ RecordWriteField(scratch1, offset, storage_reg, receiver_reg,
|
| + kLRHasNotBeenSaved, kDontSaveFPRegs,
|
| + EMIT_REMEMBERED_SET, smi_check);
|
| }
|
| }
|
|
|
| @@ -614,8 +416,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
|
|
|
| // Make sure there's no overlap between holder and object registers.
|
| DCHECK(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
|
| - DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
|
| - && !scratch2.is(scratch1));
|
| + DCHECK(!scratch2.is(object_reg) && !scratch2.is(holder_reg) &&
|
| + !scratch2.is(scratch1));
|
|
|
| // Keep track of the current object in register reg.
|
| Register reg = object_reg;
|
| @@ -648,10 +450,10 @@ Register PropertyHandlerCompiler::CheckPrototypes(
|
| }
|
| DCHECK(current.is_null() ||
|
| current->property_dictionary()->FindEntry(name) ==
|
| - NameDictionary::kNotFound);
|
| + NameDictionary::kNotFound);
|
|
|
| - GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
|
| - scratch1, scratch2);
|
| + GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1,
|
| + scratch2);
|
|
|
| __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
|
| reg = holder_reg; // From now on the object will be in holder_reg.
|
| @@ -674,9 +476,8 @@ Register PropertyHandlerCompiler::CheckPrototypes(
|
| if (current_map->IsJSGlobalProxyMap()) {
|
| __ CheckAccessGlobalProxy(reg, scratch2, miss);
|
| } else if (current_map->IsJSGlobalObjectMap()) {
|
| - GenerateCheckPropertyCell(
|
| - masm(), Handle<JSGlobalObject>::cast(current), name,
|
| - scratch2, miss);
|
| + GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current),
|
| + name, scratch2, miss);
|
| }
|
|
|
| reg = holder_reg; // From now on the object will be in holder_reg.
|
| @@ -765,8 +566,8 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
| __ push(receiver());
|
| if (heap()->InNewSpace(callback->data())) {
|
| __ Move(scratch3(), callback);
|
| - __ ldr(scratch3(), FieldMemOperand(scratch3(),
|
| - ExecutableAccessorInfo::kDataOffset));
|
| + __ ldr(scratch3(),
|
| + FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset));
|
| } else {
|
| __ Move(scratch3(), Handle<Object>(callback->data(), isolate()));
|
| }
|
| @@ -774,8 +575,7 @@ void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
| __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
|
| __ mov(scratch4(), scratch3());
|
| __ Push(scratch3(), scratch4());
|
| - __ mov(scratch4(),
|
| - Operand(ExternalReference::isolate_address(isolate())));
|
| + __ mov(scratch4(), Operand(ExternalReference::isolate_address(isolate())));
|
| __ Push(scratch4(), reg);
|
| __ mov(scratch2(), sp); // scratch2 = PropertyAccessorInfo::args_
|
| __ push(name());
|
| @@ -915,8 +715,8 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
|
| __ Push(receiver, value());
|
| ParameterCount actual(1);
|
| ParameterCount expected(setter);
|
| - __ InvokeFunction(setter, expected, actual,
|
| - CALL_FUNCTION, NullCallWrapper());
|
| + __ InvokeFunction(setter, expected, actual, CALL_FUNCTION,
|
| + NullCallWrapper());
|
| } else {
|
| // If we generate a global code snippet for deoptimization only, remember
|
| // the place to continue after deoptimization.
|
| @@ -955,7 +755,7 @@ Register* PropertyAccessCompiler::load_calling_convention() {
|
| // receiver, name, scratch1, scratch2, scratch3, scratch4.
|
| Register receiver = LoadIC::ReceiverRegister();
|
| Register name = LoadIC::NameRegister();
|
| - static Register registers[] = { receiver, name, r3, r0, r4, r5 };
|
| + static Register registers[] = {receiver, name, r3, r0, r4, r5};
|
| return registers;
|
| }
|
|
|
| @@ -965,7 +765,7 @@ Register* PropertyAccessCompiler::store_calling_convention() {
|
| Register receiver = StoreIC::ReceiverRegister();
|
| Register name = StoreIC::NameRegister();
|
| DCHECK(r3.is(KeyedStoreIC::MapRegister()));
|
| - static Register registers[] = { receiver, name, r3, r4, r5 };
|
| + static Register registers[] = {receiver, name, r3, r4, r5};
|
| return registers;
|
| }
|
|
|
| @@ -998,8 +798,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
|
| __ push(receiver);
|
| ParameterCount actual(0);
|
| ParameterCount expected(getter);
|
| - __ InvokeFunction(getter, expected, actual,
|
| - CALL_FUNCTION, NullCallWrapper());
|
| + __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
|
| + NullCallWrapper());
|
| } else {
|
| // If we generate a global code snippet for deoptimization only, remember
|
| // the place to continue after deoptimization.
|
| @@ -1153,8 +953,7 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
|
|
|
| __ bind(&slow);
|
| __ IncrementCounter(
|
| - masm->isolate()->counters()->keyed_load_external_array_slow(),
|
| - 1, r2, r3);
|
| + masm->isolate()->counters()->keyed_load_external_array_slow(), 1, r2, r3);
|
|
|
| TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Slow);
|
|
|
| @@ -1166,7 +965,7 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
|
|
|
|
|
| #undef __
|
| -
|
| -} } // namespace v8::internal
|
| +}
|
| +} // namespace v8::internal
|
|
|
| #endif // V8_TARGET_ARCH_ARM
|
|
|