// Copy all arguments from the array to the stack.
Label entry, loop;
- __ mov(eax, Operand(ebp, kIndexOffset));
+ __ mov(ecx, Operand(ebp, kIndexOffset));
__ jmp(&entry);
__ bind(&loop);
__ mov(edx, Operand(ebp, kArgumentsOffset)); // load arguments
__ push(eax);
// Update the index on the stack and in register eax.
- __ mov(eax, Operand(ebp, kIndexOffset));
- __ add(eax, Immediate(1 << kSmiTagSize));
- __ mov(Operand(ebp, kIndexOffset), eax);
+ __ mov(ecx, Operand(ebp, kIndexOffset));
+ __ add(ecx, Immediate(1 << kSmiTagSize));
+ __ mov(Operand(ebp, kIndexOffset), ecx);
__ bind(&entry);
- __ cmp(eax, Operand(ebp, kLimitOffset));
+ __ cmp(ecx, Operand(ebp, kLimitOffset));
__ j(not_equal, &loop);
// Invoke the function.
Label call_proxy;
+ __ mov(eax, ecx);
ParameterCount actual(eax);
__ SmiUntag(eax);
__ mov(edi, Operand(ebp, kFunctionOffset));
void Debug::GenerateLoadICDebugBreak(MacroAssembler* masm) {
// Register state for IC load call (from ic-ia32.cc).
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit(), 0, false);
+ Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false);
}
void Debug::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) {
// Register state for keyed IC load call (from ic-ia32.cc).
// ----------- S t a t e -------------
+ // -- ecx : key
// -- edx : receiver
- // -- eax : key
// -----------------------------------
- Generate_DebugBreakCallHelper(masm, eax.bit() | edx.bit(), 0, false);
+ Generate_DebugBreakCallHelper(masm, ecx.bit() | edx.bit(), 0, false);
}
// All extension objects were empty and it is safe to use a global
// load IC call.
- __ mov(eax, GlobalObjectOperand());
+ __ mov(edx, GlobalObjectOperand());
__ mov(ecx, var->name());
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
Comment cmnt(masm_, "Global variable");
// Use inline caching. Variable name is passed in ecx and the global
// object in eax.
- __ mov(eax, GlobalObjectOperand());
+ __ mov(edx, GlobalObjectOperand());
__ mov(ecx, var->name());
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
CallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
break;
case NAMED_PROPERTY:
if (expr->is_compound()) {
- // We need the receiver both on the stack and in the accumulator.
- VisitForAccumulatorValue(property->obj());
- __ push(result_register());
+ // We need the receiver both on the stack and in edx.
+ VisitForStackValue(property->obj());
+ __ mov(edx, Operand(esp, 0));
} else {
VisitForStackValue(property->obj());
}
case KEYED_PROPERTY: {
if (expr->is_compound()) {
VisitForStackValue(property->obj());
- VisitForAccumulatorValue(property->key());
- __ mov(edx, Operand(esp, 0));
- __ push(eax);
+ VisitForStackValue(property->key());
+ __ mov(edx, Operand(esp, kPointerSize)); // Object.
+ __ mov(ecx, Operand(esp, 0)); // Key.
} else {
VisitForStackValue(property->obj());
VisitForStackValue(property->key());
VisitForStackValue(prop->obj());
VisitForAccumulatorValue(prop->key());
__ mov(ecx, eax);
- __ pop(edx);
+ __ pop(edx); // Receiver.
__ pop(eax); // Restore value.
Handle<Code> ic = is_classic_mode()
? isolate()->builtins()->KeyedStoreIC_Initialize()
void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
// Assignment to a property, using a named store IC.
+ // eax : value
+ // esp[0] : receiver
+
Property* prop = expr->target()->AsProperty();
ASSERT(prop != NULL);
ASSERT(prop->key()->AsLiteral() != NULL);
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
// Assignment to a property, using a keyed store IC.
+ // eax : value
+ // esp[0] : key
+ // esp[kPointerSize] : receiver
// If the assignment starts a block of assignments to the same object,
// change to slow case to avoid the quadratic behavior of repeatedly
__ pop(result_register());
}
- __ pop(ecx);
+ __ pop(ecx); // Key.
if (expr->ends_initialization_block()) {
__ mov(edx, Operand(esp, 0)); // Leave receiver on the stack for later.
} else {
if (key->IsPropertyName()) {
VisitForAccumulatorValue(expr->obj());
+ __ mov(edx, result_register());
EmitNamedPropertyLoad(expr);
context()->Plug(eax);
} else {
VisitForStackValue(expr->obj());
VisitForAccumulatorValue(expr->key());
- __ pop(edx);
+ __ pop(edx); // Object.
+ __ mov(ecx, result_register()); // Key.
EmitKeyedPropertyLoad(expr);
context()->Plug(eax);
}
__ push(Immediate(Smi::FromInt(0)));
}
if (assign_type == NAMED_PROPERTY) {
- // Put the object both on the stack and in the accumulator.
+ // Put the object both on the stack and in edx.
VisitForAccumulatorValue(prop->obj());
__ push(eax);
+ __ mov(edx, eax);
EmitNamedPropertyLoad(prop);
} else {
VisitForStackValue(prop->obj());
- VisitForAccumulatorValue(prop->key());
- __ mov(edx, Operand(esp, 0));
- __ push(eax);
+ VisitForStackValue(prop->key());
+ __ mov(edx, Operand(esp, kPointerSize)); // Object.
+ __ mov(ecx, Operand(esp, 0)); // Key.
EmitKeyedPropertyLoad(prop);
}
}
if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable");
- __ mov(eax, GlobalObjectOperand());
+ __ mov(edx, GlobalObjectOperand());
__ mov(ecx, Immediate(proxy->name()));
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
// Use a regular load, not a contextual load, to avoid a reference
void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- StubCompiler::GenerateLoadArrayLength(masm, eax, edx, &miss);
+ StubCompiler::GenerateLoadArrayLength(masm, edx, eax, &miss);
__ bind(&miss);
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
}
void LoadIC::GenerateStringLength(MacroAssembler* masm,
bool support_wrappers) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- StubCompiler::GenerateLoadStringLength(masm, eax, edx, ebx, &miss,
+ StubCompiler::GenerateLoadStringLength(masm, edx, eax, ebx, &miss,
support_wrappers);
__ bind(&miss);
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- StubCompiler::GenerateLoadFunctionPrototype(masm, eax, edx, ebx, &miss);
+ StubCompiler::GenerateLoadFunctionPrototype(masm, edx, eax, ebx, &miss);
__ bind(&miss);
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
}
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label probe_dictionary, check_number_dictionary;
// Check that the key is a smi.
- __ JumpIfNotSmi(eax, &check_string);
+ __ JumpIfNotSmi(ecx, &check_string);
__ bind(&index_smi);
// Now the key is known to be a smi. This place is also jumped to from
// where a numeric string is converted to a smi.
GenerateKeyedLoadReceiverCheck(
- masm, edx, ecx, Map::kHasIndexedInterceptor, &slow);
+ masm, edx, eax, Map::kHasIndexedInterceptor, &slow);
// Check the receiver's map to see if it has fast elements.
- __ CheckFastElements(ecx, &check_number_dictionary);
-
- GenerateFastArrayLoad(masm,
- edx,
- eax,
- ecx,
- eax,
- NULL,
- &slow);
+ __ CheckFastElements(eax, &check_number_dictionary);
+
+ GenerateFastArrayLoad(masm, edx, ecx, eax, eax, NULL, &slow);
Isolate* isolate = masm->isolate();
Counters* counters = isolate->counters();
__ IncrementCounter(counters->keyed_load_generic_smi(), 1);
__ ret(0);
+
__ bind(&check_number_dictionary);
- __ mov(ebx, eax);
+ __ mov(ebx, ecx);
__ SmiUntag(ebx);
- __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
+ __ mov(eax, FieldOperand(edx, JSObject::kElementsOffset));
// Check whether the elements is a number dictionary.
// edx: receiver
// ebx: untagged index
- // eax: key
- // ecx: elements
- __ CheckMap(ecx,
+ // ecx: key
+ // eax: elements
+ __ CheckMap(eax,
isolate->factory()->hash_table_map(),
&slow,
DONT_DO_SMI_CHECK);
// Push receiver on the stack to free up a register for the dictionary
// probing.
__ push(edx);
- __ LoadFromNumberDictionary(&slow_pop_receiver,
- ecx,
- eax,
- ebx,
- edx,
- edi,
- eax);
+ __ LoadFromNumberDictionary(&slow_pop_receiver, eax, ecx, ebx, edx, edi, eax);
// Pop receiver before returning.
__ pop(edx);
__ ret(0);
__ bind(&slow);
// Slow case: jump to runtime.
// edx: receiver
- // eax: key
+ // ecx: key
__ IncrementCounter(counters->keyed_load_generic_slow(), 1);
GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
- GenerateKeyStringCheck(masm, eax, ecx, ebx, &index_string, &slow);
+ GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow);
GenerateKeyedLoadReceiverCheck(
- masm, edx, ecx, Map::kHasNamedInterceptor, &slow);
+ masm, edx, eax, Map::kHasNamedInterceptor, &slow);
// If the receiver is a fast-case object, check the keyed lookup
// cache. Otherwise probe the dictionary.
Immediate(isolate->factory()->hash_table_map()));
__ j(equal, &probe_dictionary);
- // Load the map of the receiver, compute the keyed lookup cache hash
+ // The receiver's map is still in eax, compute the keyed lookup cache hash
// based on 32 bits of the map pointer and the string hash.
- __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
- __ mov(ecx, ebx);
- __ shr(ecx, KeyedLookupCache::kMapHashShift);
- __ mov(edi, FieldOperand(eax, String::kHashFieldOffset));
+ if (FLAG_debug_code) {
+ __ cmp(eax, FieldOperand(edx, HeapObject::kMapOffset));
+ __ Check(equal, "Map is no longer in eax.");
+ }
+ __ mov(ebx, eax); // Keep the map around for later.
+ __ shr(eax, KeyedLookupCache::kMapHashShift);
+ __ mov(edi, FieldOperand(ecx, String::kHashFieldOffset));
__ shr(edi, String::kHashShift);
- __ xor_(ecx, edi);
- __ and_(ecx, KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
+ __ xor_(eax, edi);
+ __ and_(eax, KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
// Load the key (consisting of map and symbol) from the cache and
// check for match.
for (int i = 0; i < kEntriesPerBucket - 1; i++) {
Label try_next_entry;
- __ mov(edi, ecx);
+ __ mov(edi, eax);
__ shl(edi, kPointerSizeLog2 + 1);
if (i != 0) {
__ add(edi, Immediate(kPointerSize * i * 2));
__ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
__ j(not_equal, &try_next_entry);
__ add(edi, Immediate(kPointerSize));
- __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
+ __ cmp(ecx, Operand::StaticArray(edi, times_1, cache_keys));
__ j(equal, &hit_on_nth_entry[i]);
__ bind(&try_next_entry);
}
- __ lea(edi, Operand(ecx, 1));
+ __ lea(edi, Operand(eax, 1));
__ shl(edi, kPointerSizeLog2 + 1);
__ add(edi, Immediate(kPointerSize * (kEntriesPerBucket - 1) * 2));
__ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
__ j(not_equal, &slow);
__ add(edi, Immediate(kPointerSize));
- __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
+ __ cmp(ecx, Operand::StaticArray(edi, times_1, cache_keys));
__ j(not_equal, &slow);
// Get field offset.
// edx : receiver
// ebx : receiver's map
- // eax : key
- // ecx : lookup cache index
+ // ecx : key
+ // eax : lookup cache index
ExternalReference cache_field_offsets =
ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
for (int i = kEntriesPerBucket - 1; i >= 0; i--) {
__ bind(&hit_on_nth_entry[i]);
if (i != 0) {
- __ add(ecx, Immediate(i));
+ __ add(eax, Immediate(i));
}
__ mov(edi,
- Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
- __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
- __ sub(edi, ecx);
+ Operand::StaticArray(eax, times_pointer_size, cache_field_offsets));
+ __ movzx_b(eax, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
+ __ sub(edi, eax);
__ j(above_equal, &property_array_property);
if (i != 0) {
__ jmp(&load_in_object_property);
// Load in-object property.
__ bind(&load_in_object_property);
- __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
- __ add(ecx, edi);
- __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0));
+ __ movzx_b(eax, FieldOperand(ebx, Map::kInstanceSizeOffset));
+ __ add(eax, edi);
+ __ mov(eax, FieldOperand(edx, eax, times_pointer_size, 0));
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
__ ret(0);
// exists.
__ bind(&probe_dictionary);
- __ mov(ecx, FieldOperand(edx, JSObject::kMapOffset));
- __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
- GenerateGlobalInstanceTypeCheck(masm, ecx, &slow);
+ __ mov(eax, FieldOperand(edx, JSObject::kMapOffset));
+ __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset));
+ GenerateGlobalInstanceTypeCheck(masm, eax, &slow);
- GenerateDictionaryLoad(masm, &slow, ebx, eax, ecx, edi, eax);
+ GenerateDictionaryLoad(masm, &slow, ebx, ecx, eax, edi, eax);
__ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
__ ret(0);
__ bind(&index_string);
- __ IndexFromHash(ebx, eax);
+ __ IndexFromHash(ebx, ecx);
// Now jump to the place where smi keys are handled.
__ jmp(&index_smi);
}
void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key (index)
+ // -- ecx : key (index)
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
Register receiver = edx;
- Register index = eax;
- Register scratch = ecx;
+ Register index = ecx;
+ Register scratch = ebx;
Register result = eax;
StringCharAtGenerator char_at_generator(receiver,
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ JumpIfSmi(edx, &slow);
// Check that the key is an array index, that is Uint32.
- __ test(eax, Immediate(kSmiTagMask | kSmiSignMask));
+ __ test(ecx, Immediate(kSmiTagMask | kSmiSignMask));
__ j(not_zero, &slow);
// Get the map of the receiver.
- __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
+ __ mov(eax, FieldOperand(edx, HeapObject::kMapOffset));
// Check that it has indexed interceptor and access checks
// are not enabled for this object.
- __ movzx_b(ecx, FieldOperand(ecx, Map::kBitFieldOffset));
- __ and_(ecx, Immediate(kSlowCaseBitFieldMask));
- __ cmp(ecx, Immediate(1 << Map::kHasIndexedInterceptor));
+ __ movzx_b(eax, FieldOperand(eax, Map::kBitFieldOffset));
+ __ and_(eax, Immediate(kSlowCaseBitFieldMask));
+ __ cmp(eax, Immediate(1 << Map::kHasIndexedInterceptor));
__ j(not_zero, &slow);
// Everything is fine, call runtime.
- __ pop(ecx);
+ __ pop(eax);
__ push(edx); // receiver
- __ push(eax); // key
- __ push(ecx); // return address
+ __ push(ecx); // key
+ __ push(eax); // return address
// Perform tail call to the entry.
ExternalReference ref =
void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label slow, notin;
Factory* factory = masm->isolate()->factory();
Operand mapped_location =
- GenerateMappedArgumentsLookup(masm, edx, eax, ebx, ecx, ¬in, &slow);
+ GenerateMappedArgumentsLookup(masm, edx, ecx, ebx, eax, ¬in, &slow);
__ mov(eax, mapped_location);
__ Ret();
__ bind(¬in);
// The unmapped lookup expects that the parameter map is in ebx.
Operand unmapped_location =
- GenerateUnmappedArgumentsLookup(masm, eax, ebx, ecx, &slow);
+ GenerateUnmappedArgumentsLookup(masm, ecx, ebx, eax, &slow);
__ cmp(unmapped_location, factory->the_hole_value());
__ j(equal, &slow);
__ mov(eax, unmapped_location);
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
// Probe the stub cache.
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, MONOMORPHIC);
- Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, eax, ecx, ebx,
- edx);
+ Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
+ eax);
// Cache miss: Jump to runtime.
GenerateMiss(masm);
void LoadIC::GenerateNormal(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- GenerateStringDictionaryReceiverCheck(masm, eax, edx, ebx, &miss);
+ GenerateStringDictionaryReceiverCheck(masm, edx, eax, ebx, &miss);
- // edx: elements
+ // eax: elements
// Search the dictionary placing the result in eax.
- GenerateDictionaryLoad(masm, &miss, edx, ecx, edi, ebx, eax);
+ GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, eax);
__ ret(0);
// Cache miss: Jump to runtime.
void LoadIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
__ pop(ebx);
- __ push(eax); // receiver
+ __ push(edx); // receiver
__ push(ecx); // name
__ push(ebx); // return address
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ pop(ebx);
__ push(edx); // receiver
- __ push(eax); // name
+ __ push(ecx); // name
__ push(ebx); // return address
// Perform tail call to the entry.
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ pop(ebx);
__ push(edx); // receiver
- __ push(eax); // name
+ __ push(ecx); // name
__ push(ebx); // return address
// Perform tail call to the entry.
void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi));
- ASSERT(ToRegister(instr->global_object()).is(eax));
+ ASSERT(ToRegister(instr->global_object()).is(edx));
ASSERT(ToRegister(instr->result()).is(eax));
__ mov(ecx, instr->name());
void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi));
- ASSERT(ToRegister(instr->object()).is(eax));
+ ASSERT(ToRegister(instr->object()).is(edx));
ASSERT(ToRegister(instr->result()).is(eax));
__ mov(ecx, instr->name());
void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
ASSERT(ToRegister(instr->context()).is(esi));
ASSERT(ToRegister(instr->object()).is(edx));
- ASSERT(ToRegister(instr->key()).is(eax));
+ ASSERT(ToRegister(instr->key()).is(ecx));
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi);
- LOperand* global_object = UseFixed(instr->global_object(), eax);
+ LOperand* global_object = UseFixed(instr->global_object(), edx);
LLoadGlobalGeneric* result =
new(zone()) LLoadGlobalGeneric(context, global_object);
return MarkAsCall(DefineFixed(result, eax), instr);
ASSERT(instr->representation().IsTagged());
if (instr->need_generic()) {
LOperand* context = UseFixed(instr->context(), esi);
- LOperand* obj = UseFixed(instr->object(), eax);
+ LOperand* obj = UseFixed(instr->object(), edx);
LLoadNamedFieldPolymorphic* result =
new(zone()) LLoadNamedFieldPolymorphic(context, obj);
return MarkAsCall(DefineFixed(result, eax), instr);
LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi);
- LOperand* object = UseFixed(instr->object(), eax);
+ LOperand* object = UseFixed(instr->object(), edx);
LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object);
return MarkAsCall(DefineFixed(result, eax), instr);
}
LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
LOperand* context = UseFixed(instr->context(), esi);
LOperand* object = UseFixed(instr->object(), edx);
- LOperand* key = UseFixed(instr->key(), eax);
+ LOperand* key = UseFixed(instr->key(), ecx);
LLoadKeyedGeneric* result =
new(zone()) LLoadKeyedGeneric(context, object, key);
Handle<JSObject> object,
Handle<JSObject> last) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
// Check that the receiver isn't a smi.
- __ JumpIfSmi(eax, &miss);
+ __ JumpIfSmi(edx, &miss);
ASSERT(last->IsGlobalObject() || last->HasFastProperties());
// Check the maps of the full prototype chain. Also check that
// global property cells up to (but not including) the last object
// in the prototype chain are empty.
- CheckPrototypes(object, eax, last, ebx, edx, edi, name, &miss);
+ CheckPrototypes(object, edx, last, ebx, eax, edi, name, &miss);
// If the last object in the prototype chain is a global object,
// check that the global property cell is empty.
if (last->IsGlobalObject()) {
GenerateCheckPropertyCell(
- masm(), Handle<GlobalObject>::cast(last), name, edx, &miss);
+ masm(), Handle<GlobalObject>::cast(last), name, eax, &miss);
}
// Return undefined if maps of the full prototype chain are still the
int index,
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- GenerateLoadField(object, holder, eax, ebx, edx, edi, index, name, &miss);
+ GenerateLoadField(object, holder, edx, ebx, eax, edi, index, name, &miss);
__ bind(&miss);
GenerateLoadMiss(masm(), Code::LOAD_IC);
Handle<JSObject> holder,
Handle<AccessorInfo> callback) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- GenerateLoadCallback(object, holder, eax, ecx, ebx, edx, edi, callback,
+ GenerateLoadCallback(object, holder, edx, ecx, ebx, eax, edi, callback,
name, &miss);
__ bind(&miss);
GenerateLoadMiss(masm(), Code::LOAD_IC);
Handle<JSFunction> value,
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
- GenerateLoadConstant(object, holder, eax, ebx, edx, edi, value, name, &miss);
+ GenerateLoadConstant(object, holder, edx, ebx, eax, edi, value, name, &miss);
__ bind(&miss);
GenerateLoadMiss(masm(), Code::LOAD_IC);
Handle<JSObject> holder,
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
// TODO(368): Compile in the whole chain: all the interceptors in
// prototypes and ultimate answer.
- GenerateLoadInterceptor(receiver, holder, &lookup, eax, ecx, edx, ebx, edi,
+ GenerateLoadInterceptor(receiver, holder, &lookup, edx, ecx, eax, ebx, edi,
name, &miss);
__ bind(&miss);
Handle<String> name,
bool is_dont_delete) {
// ----------- S t a t e -------------
- // -- eax : receiver
// -- ecx : name
+ // -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
Label miss;
// Check that the maps haven't changed.
- __ JumpIfSmi(eax, &miss);
- CheckPrototypes(object, eax, holder, ebx, edx, edi, name, &miss);
+ __ JumpIfSmi(edx, &miss);
+ CheckPrototypes(object, edx, holder, ebx, eax, edi, name, &miss);
// Get the value from the cell.
if (Serializer::enabled()) {
Handle<JSObject> holder,
int index) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_field(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
GenerateLoadField(receiver, holder, edx, ebx, ecx, edi, index, name, &miss);
Handle<JSObject> holder,
Handle<AccessorInfo> callback) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_callback(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
- GenerateLoadCallback(receiver, holder, edx, eax, ebx, ecx, edi, callback,
+ GenerateLoadCallback(receiver, holder, edx, ecx, ebx, eax, edi, callback,
name, &miss);
__ bind(&miss);
Handle<JSObject> holder,
Handle<JSFunction> value) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_constant_function(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
GenerateLoadConstant(
- receiver, holder, edx, ebx, ecx, edi, value, name, &miss);
+ receiver, holder, edx, ebx, eax, edi, value, name, &miss);
__ bind(&miss);
__ DecrementCounter(counters->keyed_load_constant_function(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
Handle<JSObject> holder,
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_interceptor(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
LookupResult lookup(isolate());
LookupPostInterceptor(holder, name, &lookup);
- GenerateLoadInterceptor(receiver, holder, &lookup, edx, eax, ecx, ebx, edi,
+ GenerateLoadInterceptor(receiver, holder, &lookup, edx, ecx, eax, ebx, edi,
name, &miss);
__ bind(&miss);
__ DecrementCounter(counters->keyed_load_interceptor(), 1);
Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength(
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_array_length(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
- GenerateLoadArrayLength(masm(), edx, ecx, &miss);
+ GenerateLoadArrayLength(masm(), edx, eax, &miss);
__ bind(&miss);
__ DecrementCounter(counters->keyed_load_array_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength(
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_string_length(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
- GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss, true);
+ GenerateLoadStringLength(masm(), edx, eax, ebx, &miss, true);
__ bind(&miss);
__ DecrementCounter(counters->keyed_load_string_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype(
Handle<String> name) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(counters->keyed_load_function_prototype(), 1);
// Check that the name has not changed.
- __ cmp(eax, Immediate(name));
+ __ cmp(ecx, Immediate(name));
__ j(not_equal, &miss);
- GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss);
+ GenerateLoadFunctionPrototype(masm(), edx, eax, ebx, &miss);
__ bind(&miss);
__ DecrementCounter(counters->keyed_load_function_prototype(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
Handle<Map> receiver_map) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
MapHandleList* receiver_maps,
CodeHandleList* handler_ics) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
// This stub is meant to be tail-jumped to, the receiver must already
// have been verified by the caller to not be a smi.
- __ JumpIfNotSmi(eax, &miss_force_generic);
- __ mov(ebx, eax);
+ __ JumpIfNotSmi(ecx, &miss_force_generic);
+ __ mov(ebx, ecx);
__ SmiUntag(ebx);
- __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
+ __ mov(eax, FieldOperand(edx, JSObject::kElementsOffset));
// Push receiver on the stack to free up a register for the dictionary
// probing.
__ push(edx);
- __ LoadFromNumberDictionary(&slow,
- ecx,
- eax,
- ebx,
- edx,
- edi,
- eax);
+ __ LoadFromNumberDictionary(&slow, eax, ecx, ebx, edx, edi, eax);
// Pop receiver before returning.
__ pop(edx);
__ ret(0);
__ pop(edx);
// ----------- S t a t e -------------
- // -- eax : value
// -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
__ bind(&miss_force_generic);
// ----------- S t a t e -------------
- // -- eax : value
// -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
MacroAssembler* masm,
ElementsKind elements_kind) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
// have been verified by the caller to not be a smi.
// Check that the key is a smi or a heap number convertible to a smi.
- GenerateSmiKeyCheck(masm, eax, ecx, xmm0, xmm1, &miss_force_generic);
+ GenerateSmiKeyCheck(masm, ecx, eax, xmm0, xmm1, &miss_force_generic);
// Check that the index is in range.
__ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset));
- __ cmp(eax, FieldOperand(ebx, ExternalArray::kLengthOffset));
+ __ cmp(ecx, FieldOperand(ebx, ExternalArray::kLengthOffset));
// Unsigned comparison catches both negative and too-large values.
__ j(above_equal, &miss_force_generic);
__ mov(ebx, FieldOperand(ebx, ExternalArray::kExternalPointerOffset));
// ebx: base pointer of external storage
switch (elements_kind) {
case EXTERNAL_BYTE_ELEMENTS:
- __ SmiUntag(eax); // Untag the index.
- __ movsx_b(eax, Operand(ebx, eax, times_1, 0));
+ __ SmiUntag(ecx); // Untag the index.
+ __ movsx_b(eax, Operand(ebx, ecx, times_1, 0));
break;
case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
case EXTERNAL_PIXEL_ELEMENTS:
- __ SmiUntag(eax); // Untag the index.
- __ movzx_b(eax, Operand(ebx, eax, times_1, 0));
+ __ SmiUntag(ecx); // Untag the index.
+ __ movzx_b(eax, Operand(ebx, ecx, times_1, 0));
break;
case EXTERNAL_SHORT_ELEMENTS:
- __ movsx_w(eax, Operand(ebx, eax, times_1, 0));
+ __ movsx_w(eax, Operand(ebx, ecx, times_1, 0));
break;
case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- __ movzx_w(eax, Operand(ebx, eax, times_1, 0));
+ __ movzx_w(eax, Operand(ebx, ecx, times_1, 0));
break;
case EXTERNAL_UNSIGNED_INT_ELEMENTS:
case EXTERNAL_INT_ELEMENTS:
- __ mov(ecx, Operand(ebx, eax, times_2, 0));
+ __ mov(eax, Operand(ebx, ecx, times_2, 0));
break;
case EXTERNAL_FLOAT_ELEMENTS:
- __ fld_s(Operand(ebx, eax, times_2, 0));
+ __ fld_s(Operand(ebx, ecx, times_2, 0));
break;
case EXTERNAL_DOUBLE_ELEMENTS:
- __ fld_d(Operand(ebx, eax, times_4, 0));
+ __ fld_d(Operand(ebx, ecx, times_4, 0));
break;
default:
UNREACHABLE();
}
// For integer array types:
- // ecx: value
+ // eax: value
// For floating-point array type:
// FP(0): value
// it to a HeapNumber.
Label box_int;
if (elements_kind == EXTERNAL_INT_ELEMENTS) {
- __ cmp(ecx, 0xc0000000);
+ __ cmp(eax, 0xc0000000);
__ j(sign, &box_int);
} else {
ASSERT_EQ(EXTERNAL_UNSIGNED_INT_ELEMENTS, elements_kind);
// The test is different for unsigned int values. Since we need
// the value to be in the range of a positive smi, we can't
// handle either of the top two bits being set in the value.
- __ test(ecx, Immediate(0xc0000000));
+ __ test(eax, Immediate(0xc0000000));
__ j(not_zero, &box_int);
}
- __ mov(eax, ecx);
__ SmiTag(eax);
__ ret(0);
// Allocate a HeapNumber for the int and perform int-to-double
// conversion.
if (elements_kind == EXTERNAL_INT_ELEMENTS) {
- __ push(ecx);
+ __ push(eax);
__ fild_s(Operand(esp, 0));
- __ pop(ecx);
+ __ pop(eax);
} else {
ASSERT_EQ(EXTERNAL_UNSIGNED_INT_ELEMENTS, elements_kind);
// Need to zero-extend the value.
// There's no fild variant for unsigned values, so zero-extend
// to a 64-bit int manually.
__ push(Immediate(0));
- __ push(ecx);
+ __ push(eax);
__ fild_d(Operand(esp, 0));
- __ pop(ecx);
- __ pop(ecx);
+ __ pop(eax);
+ __ pop(eax);
}
// FP(0): value
- __ AllocateHeapNumber(ecx, ebx, edi, &failed_allocation);
+ __ AllocateHeapNumber(eax, ebx, edi, &failed_allocation);
// Set the value.
- __ mov(eax, ecx);
__ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
__ ret(0);
} else if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
// For the floating-point array type, we need to always allocate a
// HeapNumber.
- __ AllocateHeapNumber(ecx, ebx, edi, &failed_allocation);
+ __ AllocateHeapNumber(eax, ebx, edi, &failed_allocation);
// Set the value.
- __ mov(eax, ecx);
__ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
__ ret(0);
} else {
__ IncrementCounter(counters->keyed_load_external_array_slow(), 1);
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
__ jmp(ic, RelocInfo::CODE_TARGET);
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
void KeyedLoadStubCompiler::GenerateLoadFastElement(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
// have been verified by the caller to not be a smi.
// Check that the key is a smi or a heap number convertible to a smi.
- GenerateSmiKeyCheck(masm, eax, ecx, xmm0, xmm1, &miss_force_generic);
+ GenerateSmiKeyCheck(masm, ecx, eax, xmm0, xmm1, &miss_force_generic);
// Get the elements array.
- __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
- __ AssertFastElements(ecx);
+ __ mov(eax, FieldOperand(edx, JSObject::kElementsOffset));
+ __ AssertFastElements(eax);
// Check that the key is within bounds.
- __ cmp(eax, FieldOperand(ecx, FixedArray::kLengthOffset));
+ __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset));
__ j(above_equal, &miss_force_generic);
// Load the result and make sure it's not the hole.
- __ mov(ebx, Operand(ecx, eax, times_2,
+ __ mov(ebx, Operand(eax, ecx, times_2,
FixedArray::kHeaderSize - kHeapObjectTag));
__ cmp(ebx, masm->isolate()->factory()->the_hole_value());
__ j(equal, &miss_force_generic);
void KeyedLoadStubCompiler::GenerateLoadFastDoubleElement(
MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- eax : key
+ // -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
// have been verified by the caller to not be a smi.
// Check that the key is a smi or a heap number convertible to a smi.
- GenerateSmiKeyCheck(masm, eax, ecx, xmm0, xmm1, &miss_force_generic);
+ GenerateSmiKeyCheck(masm, ecx, eax, xmm0, xmm1, &miss_force_generic);
// Get the elements array.
- __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
- __ AssertFastElements(ecx);
+ __ mov(eax, FieldOperand(edx, JSObject::kElementsOffset));
+ __ AssertFastElements(eax);
// Check that the key is within bounds.
- __ cmp(eax, FieldOperand(ecx, FixedDoubleArray::kLengthOffset));
+ __ cmp(ecx, FieldOperand(eax, FixedDoubleArray::kLengthOffset));
__ j(above_equal, &miss_force_generic);
// Check for the hole
uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
- __ cmp(FieldOperand(ecx, eax, times_4, offset), Immediate(kHoleNanUpper32));
+ __ cmp(FieldOperand(eax, ecx, times_4, offset), Immediate(kHoleNanUpper32));
__ j(equal, &miss_force_generic);
// Always allocate a heap number for the result.
if (CpuFeatures::IsSupported(SSE2)) {
CpuFeatures::Scope use_sse2(SSE2);
- __ movdbl(xmm0, FieldOperand(ecx, eax, times_4,
+ __ movdbl(xmm0, FieldOperand(eax, ecx, times_4,
FixedDoubleArray::kHeaderSize));
} else {
- __ fld_d(FieldOperand(ecx, eax, times_4, FixedDoubleArray::kHeaderSize));
+ __ fld_d(FieldOperand(eax, ecx, times_4, FixedDoubleArray::kHeaderSize));
}
- __ AllocateHeapNumber(ecx, ebx, edi, &slow_allocate_heapnumber);
+ __ AllocateHeapNumber(eax, ebx, edi, &slow_allocate_heapnumber);
// Set the value.
if (CpuFeatures::IsSupported(SSE2)) {
CpuFeatures::Scope use_sse2(SSE2);
- __ movdbl(FieldOperand(ecx, HeapNumber::kValueOffset), xmm0);
+ __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0);
} else {
- __ fstp_d(FieldOperand(ecx, HeapNumber::kValueOffset));
+ __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
}
- __ mov(eax, ecx);
__ ret(0);
__ bind(&slow_allocate_heapnumber);