📄 ic-ia32.cc.svn-base
字号:
__ bind(&fast); // eax: value // ecx: FixedArray // ebx: index (as a smi) __ mov(Operand(ecx, ebx, times_2, Array::kHeaderSize - kHeapObjectTag), eax); // Update write barrier for the elements array address. __ mov(edx, Operand(eax)); __ RecordWrite(ecx, 0, edx, ebx); __ ret(0);}// Defined in ic.cc.Object* CallIC_Miss(Arguments args);void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { // ----------- S t a t e ------------- // ----------------------------------- Label number, non_number, non_string, boolean, probe, miss; // Get the receiver of the function from the stack; 1 ~ return address. __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // Get the name of the function from the stack; 2 ~ return address, receiver __ mov(ecx, Operand(esp, (argc + 2) * kPointerSize)); // Probe the stub cache. Code::Flags flags = Code::ComputeFlags(Code::CALL_IC, MONOMORPHIC, NORMAL, argc); StubCache::GenerateProbe(masm, flags, edx, ecx, ebx); // If the stub cache probing failed, the receiver might be a value. // For value objects, we use the map of the prototype objects for // the corresponding JSValue for the cache and that is what we need // to probe. // // Check for number. __ test(edx, Immediate(kSmiTagMask)); __ j(zero, &number, not_taken); __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); __ cmp(ebx, HEAP_NUMBER_TYPE); __ j(not_equal, &non_number, taken); __ bind(&number); StubCompiler::GenerateLoadGlobalFunctionPrototype( masm, Context::NUMBER_FUNCTION_INDEX, edx); __ jmp(&probe); // Check for string. __ bind(&non_number); __ cmp(ebx, FIRST_NONSTRING_TYPE); __ j(above_equal, &non_string, taken); StubCompiler::GenerateLoadGlobalFunctionPrototype( masm, Context::STRING_FUNCTION_INDEX, edx); __ jmp(&probe); // Check for boolean. __ bind(&non_string); __ cmp(edx, Factory::true_value()); __ j(equal, &boolean, not_taken); __ cmp(edx, Factory::false_value()); __ j(not_equal, &miss, taken); __ bind(&boolean); StubCompiler::GenerateLoadGlobalFunctionPrototype( masm, Context::BOOLEAN_FUNCTION_INDEX, edx); // Probe the stub cache for the value object. __ bind(&probe); StubCache::GenerateProbe(masm, flags, edx, ecx, ebx); // Cache miss: Jump to runtime. __ bind(&miss); Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss)));}void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { // ----------- S t a t e ------------- // ----------------------------------- Label miss, probe, global; // Get the receiver of the function from the stack; 1 ~ return address. __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // Get the name of the function from the stack; 2 ~ return address, receiver. __ mov(ecx, Operand(esp, (argc + 2) * kPointerSize)); // Check that the receiver isn't a smi. __ test(edx, Immediate(kSmiTagMask)); __ j(zero, &miss, not_taken); // Check that the receiver is a valid JS object. __ mov(eax, FieldOperand(edx, HeapObject::kMapOffset)); __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset)); __ cmp(eax, FIRST_JS_OBJECT_TYPE); __ j(less, &miss, not_taken); // If this assert fails, we have to check upper bound too. ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); // Check for access to global object. __ cmp(eax, JS_GLOBAL_OBJECT_TYPE); __ j(equal, &global, not_taken); // Search the dictionary placing the result in edx. __ bind(&probe); GenerateDictionaryLoad(masm, &miss, eax, edx, ebx, ecx); // Move the result to register edi and check that it isn't a smi. __ mov(edi, Operand(edx)); __ test(edx, Immediate(kSmiTagMask)); __ j(zero, &miss, not_taken); // Check that the value is a JavaScript function. __ mov(edx, FieldOperand(edx, HeapObject::kMapOffset)); __ movzx_b(edx, FieldOperand(edx, Map::kInstanceTypeOffset)); __ cmp(edx, JS_FUNCTION_TYPE); __ j(not_equal, &miss, not_taken); // Invoke the function. ParameterCount actual(argc); __ InvokeFunction(edi, actual, JUMP_FUNCTION); // Global object access: Check access rights. __ bind(&global); __ CheckAccessGlobal(edx, eax, &miss); __ jmp(&probe); // Cache miss: Jump to runtime. __ bind(&miss); Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss)));}void CallIC::Generate(MacroAssembler* masm, int argc, const ExternalReference& f) { // ----------- S t a t e ------------- // ----------------------------------- // Get the receiver of the function from the stack; 1 ~ return address. __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // Get the name of the function to call from the stack. // 2 ~ receiver, return address. __ mov(ebx, Operand(esp, (argc + 2) * kPointerSize)); // Enter an internal frame. __ EnterInternalFrame(); // Push the receiver and the name of the function. __ push(Operand(edx)); __ push(Operand(ebx)); // Call the entry. CEntryStub stub; __ mov(Operand(eax), Immediate(2)); __ mov(Operand(ebx), Immediate(f)); __ CallStub(&stub); // Move result to edi and exit the internal frame. __ mov(Operand(edi), eax); __ LeaveInternalFrame(); // Invoke the function. ParameterCount actual(argc); __ InvokeFunction(edi, actual, JUMP_FUNCTION);}// Defined in ic.cc.Object* LoadIC_Miss(Arguments args);void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- __ mov(eax, Operand(esp, kPointerSize)); // Probe the stub cache. Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, MONOMORPHIC); StubCache::GenerateProbe(masm, flags, eax, ecx, ebx); // Cache miss: Jump to runtime. Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));}void LoadIC::GenerateNormal(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- Label miss, probe, global; __ mov(eax, Operand(esp, kPointerSize)); // Check that the receiver isn't a smi. __ test(eax, Immediate(kSmiTagMask)); __ j(zero, &miss, not_taken); // Check that the receiver is a valid JS object. __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); __ movzx_b(edx, FieldOperand(edx, Map::kInstanceTypeOffset)); __ cmp(edx, FIRST_JS_OBJECT_TYPE); __ j(less, &miss, not_taken); // If this assert fails, we have to check upper bound too. ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); // Check for access to global object (unlikely). __ cmp(edx, JS_GLOBAL_OBJECT_TYPE); __ j(equal, &global, not_taken); // Search the dictionary placing the result in eax. __ bind(&probe); GenerateDictionaryLoad(masm, &miss, edx, eax, ebx, ecx); __ ret(0); // Global object access: Check access rights. __ bind(&global); __ CheckAccessGlobal(eax, edx, &miss); __ jmp(&probe); // Cache miss: Restore receiver from stack and jump to runtime. __ bind(&miss); __ mov(eax, Operand(esp, 1 * kPointerSize)); Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));}void LoadIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));}void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { // ----------- S t a t e ------------- // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- __ mov(eax, Operand(esp, kPointerSize)); // Move the return address below the arguments. __ pop(ebx); __ push(eax); __ push(ecx); __ push(ebx); // Perform tail call to the entry. __ TailCallRuntime(f, 2);}// Defined in ic.cc.Object* KeyedLoadIC_Miss(Arguments args);void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- esp[0] : return address // -- esp[4] : name // -- esp[8] : receiver // ----------------------------------- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));}void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { // ----------- S t a t e ------------- // -- esp[0] : return address // -- esp[4] : name // -- esp[8] : receiver // ----------------------------------- __ mov(eax, Operand(esp, kPointerSize)); __ mov(ecx, Operand(esp, 2 * kPointerSize)); // Move the return address below the arguments. __ pop(ebx); __ push(ecx); __ push(eax); __ push(ebx); // Perform tail call to the entry. __ TailCallRuntime(f, 2);}// Defined in ic.cc.Object* StoreIC_Miss(Arguments args);void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- eax : value // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- // Get the receiver from the stack and probe the stub cache. __ mov(edx, Operand(esp, 4)); Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, MONOMORPHIC); StubCache::GenerateProbe(masm, flags, edx, ecx, ebx); // Cache miss: Jump to runtime. Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss)));}void StoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { // ----------- S t a t e ------------- // -- eax : value // -- ecx : name // -- esp[0] : return address // -- esp[4] : receiver // ----------------------------------- // Move the return address below the arguments. __ pop(ebx); __ push(Operand(esp, 0)); __ push(ecx); __ push(eax); __ push(ebx); // Perform tail call to the entry. __ TailCallRuntime(f, 3);}// Defined in ic.cc.Object* KeyedStoreIC_Miss(Arguments args);void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { // ----------- S t a t e ------------- // -- eax : value // -- esp[0] : return address // -- esp[4] : key // -- esp[8] : receiver // ----------------------------------- // Move the return address below the arguments. __ pop(ecx); __ push(Operand(esp, 1 * kPointerSize)); __ push(Operand(esp, 1 * kPointerSize)); __ push(eax); __ push(ecx); // Do tail-call to runtime routine. __ TailCallRuntime(f, 3);}#undef __} } // namespace v8::internal
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -