| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // o ebp: our caller's frame pointer | 112 // o ebp: our caller's frame pointer |
| 113 // o esp: stack pointer (pointing to return address) | 113 // o esp: stack pointer (pointing to return address) |
| 114 // | 114 // |
| 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 116 // frames-ia32.h for its layout. | 116 // frames-ia32.h for its layout. |
| 117 void FullCodeGenerator::Generate() { | 117 void FullCodeGenerator::Generate() { |
| 118 CompilationInfo* info = info_; | 118 CompilationInfo* info = info_; |
| 119 handler_table_ = | 119 handler_table_ = |
| 120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
| 121 | 121 |
| 122 InitializeFeedbackVector(); | |
| 123 | |
| 124 profiling_counter_ = isolate()->factory()->NewCell( | 122 profiling_counter_ = isolate()->factory()->NewCell( |
| 125 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 123 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
| 126 SetFunctionPosition(function()); | 124 SetFunctionPosition(function()); |
| 127 Comment cmnt(masm_, "[ function compiled by full code generator"); | 125 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 128 | 126 |
| 129 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 127 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 130 | 128 |
| 131 #ifdef DEBUG | 129 #ifdef DEBUG |
| 132 if (strlen(FLAG_stop_at) > 0 && | 130 if (strlen(FLAG_stop_at) > 0 && |
| 133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 131 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 __ jmp(&loop); | 1095 __ jmp(&loop); |
| 1098 | 1096 |
| 1099 __ bind(&no_descriptors); | 1097 __ bind(&no_descriptors); |
| 1100 __ add(esp, Immediate(kPointerSize)); | 1098 __ add(esp, Immediate(kPointerSize)); |
| 1101 __ jmp(&exit); | 1099 __ jmp(&exit); |
| 1102 | 1100 |
| 1103 // We got a fixed array in register eax. Iterate through that. | 1101 // We got a fixed array in register eax. Iterate through that. |
| 1104 Label non_proxy; | 1102 Label non_proxy; |
| 1105 __ bind(&fixed_array); | 1103 __ bind(&fixed_array); |
| 1106 | 1104 |
| 1107 Handle<Object> feedback = Handle<Object>( | |
| 1108 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), | |
| 1109 isolate()); | |
| 1110 StoreFeedbackVectorSlot(slot, feedback); | |
| 1111 | |
| 1112 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1105 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1113 __ LoadHeapObject(ebx, FeedbackVector()); | 1106 __ LoadHeapObject(ebx, FeedbackVector()); |
| 1114 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), | 1107 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), |
| 1115 Immediate(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker))); | 1108 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate()))); |
| 1116 | 1109 |
| 1117 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1110 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
| 1118 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1111 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
| 1119 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1112 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1120 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1113 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); |
| 1121 __ j(above, &non_proxy); | 1114 __ j(above, &non_proxy); |
| 1122 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1115 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
| 1123 __ bind(&non_proxy); | 1116 __ bind(&non_proxy); |
| 1124 __ push(ebx); // Smi | 1117 __ push(ebx); // Smi |
| 1125 __ push(eax); // Array | 1118 __ push(eax); // Array |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2661 ZoneList<Expression*>* args = expr->arguments(); | 2654 ZoneList<Expression*>* args = expr->arguments(); |
| 2662 int arg_count = args->length(); | 2655 int arg_count = args->length(); |
| 2663 { PreservePositionScope scope(masm()->positions_recorder()); | 2656 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2664 for (int i = 0; i < arg_count; i++) { | 2657 for (int i = 0; i < arg_count; i++) { |
| 2665 VisitForStackValue(args->at(i)); | 2658 VisitForStackValue(args->at(i)); |
| 2666 } | 2659 } |
| 2667 } | 2660 } |
| 2668 // Record source position for debugger. | 2661 // Record source position for debugger. |
| 2669 SetSourcePosition(expr->position()); | 2662 SetSourcePosition(expr->position()); |
| 2670 | 2663 |
| 2671 Handle<Object> uninitialized = | |
| 2672 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2673 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
| 2674 __ LoadHeapObject(ebx, FeedbackVector()); | 2664 __ LoadHeapObject(ebx, FeedbackVector()); |
| 2675 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); | 2665 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); |
| 2676 | 2666 |
| 2677 // Record call targets in unoptimized code. | 2667 // Record call targets in unoptimized code. |
| 2678 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2668 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
| 2679 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2669 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2680 __ CallStub(&stub); | 2670 __ CallStub(&stub); |
| 2681 | 2671 |
| 2682 RecordJSReturnSite(expr); | 2672 RecordJSReturnSite(expr); |
| 2683 // Restore context register. | 2673 // Restore context register. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 | 2831 |
| 2842 // Call the construct call builtin that handles allocation and | 2832 // Call the construct call builtin that handles allocation and |
| 2843 // constructor invocation. | 2833 // constructor invocation. |
| 2844 SetSourcePosition(expr->position()); | 2834 SetSourcePosition(expr->position()); |
| 2845 | 2835 |
| 2846 // Load function and argument count into edi and eax. | 2836 // Load function and argument count into edi and eax. |
| 2847 __ Set(eax, Immediate(arg_count)); | 2837 __ Set(eax, Immediate(arg_count)); |
| 2848 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2838 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2849 | 2839 |
| 2850 // Record call targets in unoptimized code. | 2840 // Record call targets in unoptimized code. |
| 2851 Handle<Object> uninitialized = | |
| 2852 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2853 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
| 2854 __ LoadHeapObject(ebx, FeedbackVector()); | 2841 __ LoadHeapObject(ebx, FeedbackVector()); |
| 2855 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2842 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
| 2856 | 2843 |
| 2857 CallConstructStub stub(RECORD_CALL_TARGET); | 2844 CallConstructStub stub(RECORD_CALL_TARGET); |
| 2858 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2845 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
| 2859 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2846 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 2860 context()->Plug(eax); | 2847 context()->Plug(eax); |
| 2861 } | 2848 } |
| 2862 | 2849 |
| 2863 | 2850 |
| (...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4912 | 4899 |
| 4913 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4900 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4914 Assembler::target_address_at(call_target_address)); | 4901 Assembler::target_address_at(call_target_address)); |
| 4915 return OSR_AFTER_STACK_CHECK; | 4902 return OSR_AFTER_STACK_CHECK; |
| 4916 } | 4903 } |
| 4917 | 4904 |
| 4918 | 4905 |
| 4919 } } // namespace v8::internal | 4906 } } // namespace v8::internal |
| 4920 | 4907 |
| 4921 #endif // V8_TARGET_ARCH_IA32 | 4908 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |