| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // o esi: our context | 111 // o esi: our context |
| 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 profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( | 121 profiling_counter_ = isolate()->factory()->NewCell( |
| 122 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 122 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
| 123 SetFunctionPosition(function()); | 123 SetFunctionPosition(function()); |
| 124 Comment cmnt(masm_, "[ function compiled by full code generator"); | 124 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 125 | 125 |
| 126 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 126 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 127 | 127 |
| 128 #ifdef DEBUG | 128 #ifdef DEBUG |
| 129 if (strlen(FLAG_stop_at) > 0 && | 129 if (strlen(FLAG_stop_at) > 0 && |
| 130 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 130 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 131 __ int3(); | 131 __ int3(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 | 309 |
| 310 | 310 |
| 311 void FullCodeGenerator::ClearAccumulator() { | 311 void FullCodeGenerator::ClearAccumulator() { |
| 312 __ Set(eax, Immediate(Smi::FromInt(0))); | 312 __ Set(eax, Immediate(Smi::FromInt(0))); |
| 313 } | 313 } |
| 314 | 314 |
| 315 | 315 |
| 316 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 316 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
| 317 __ mov(ebx, Immediate(profiling_counter_)); | 317 __ mov(ebx, Immediate(profiling_counter_)); |
| 318 __ sub(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), | 318 __ sub(FieldOperand(ebx, Cell::kValueOffset), |
| 319 Immediate(Smi::FromInt(delta))); | 319 Immediate(Smi::FromInt(delta))); |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 void FullCodeGenerator::EmitProfilingCounterReset() { | 323 void FullCodeGenerator::EmitProfilingCounterReset() { |
| 324 int reset_value = FLAG_interrupt_budget; | 324 int reset_value = FLAG_interrupt_budget; |
| 325 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { | 325 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { |
| 326 // Self-optimization is a one-off thing: if it fails, don't try again. | 326 // Self-optimization is a one-off thing: if it fails, don't try again. |
| 327 reset_value = Smi::kMaxValue; | 327 reset_value = Smi::kMaxValue; |
| 328 } | 328 } |
| 329 __ mov(ebx, Immediate(profiling_counter_)); | 329 __ mov(ebx, Immediate(profiling_counter_)); |
| 330 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), | 330 __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| 331 Immediate(Smi::FromInt(reset_value))); | 331 Immediate(Smi::FromInt(reset_value))); |
| 332 } | 332 } |
| 333 | 333 |
| 334 | 334 |
| 335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 335 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
| 336 Label* back_edge_target) { | 336 Label* back_edge_target) { |
| 337 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 337 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 338 Label ok; | 338 Label ok; |
| 339 | 339 |
| 340 int weight = 1; | 340 int weight = 1; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 __ jmp(&loop); | 1098 __ jmp(&loop); |
| 1099 | 1099 |
| 1100 __ bind(&no_descriptors); | 1100 __ bind(&no_descriptors); |
| 1101 __ add(esp, Immediate(kPointerSize)); | 1101 __ add(esp, Immediate(kPointerSize)); |
| 1102 __ jmp(&exit); | 1102 __ jmp(&exit); |
| 1103 | 1103 |
| 1104 // We got a fixed array in register eax. Iterate through that. | 1104 // We got a fixed array in register eax. Iterate through that. |
| 1105 Label non_proxy; | 1105 Label non_proxy; |
| 1106 __ bind(&fixed_array); | 1106 __ bind(&fixed_array); |
| 1107 | 1107 |
| 1108 Handle<JSGlobalPropertyCell> cell = | 1108 Handle<Cell> cell = isolate()->factory()->NewCell( |
| 1109 isolate()->factory()->NewJSGlobalPropertyCell( | 1109 Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), |
| 1110 Handle<Object>( | 1110 isolate())); |
| 1111 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), | |
| 1112 isolate())); | |
| 1113 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); | 1111 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); |
| 1114 __ LoadHeapObject(ebx, cell); | 1112 __ LoadHeapObject(ebx, cell); |
| 1115 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), | 1113 __ mov(FieldOperand(ebx, Cell::kValueOffset), |
| 1116 Immediate(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); | 1114 Immediate(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); |
| 1117 | 1115 |
| 1118 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1116 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
| 1119 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1117 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
| 1120 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1118 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1121 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1119 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); |
| 1122 __ j(above, &non_proxy); | 1120 __ j(above, &non_proxy); |
| 1123 __ mov(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1121 __ mov(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
| 1124 __ bind(&non_proxy); | 1122 __ bind(&non_proxy); |
| 1125 __ push(ebx); // Smi | 1123 __ push(ebx); // Smi |
| (...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2630 VisitForStackValue(args->at(i)); | 2628 VisitForStackValue(args->at(i)); |
| 2631 } | 2629 } |
| 2632 } | 2630 } |
| 2633 // Record source position for debugger. | 2631 // Record source position for debugger. |
| 2634 SetSourcePosition(expr->position()); | 2632 SetSourcePosition(expr->position()); |
| 2635 | 2633 |
| 2636 // Record call targets in unoptimized code. | 2634 // Record call targets in unoptimized code. |
| 2637 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2635 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
| 2638 Handle<Object> uninitialized = | 2636 Handle<Object> uninitialized = |
| 2639 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2637 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2640 Handle<JSGlobalPropertyCell> cell = | 2638 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
| 2641 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
| 2642 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2639 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
| 2643 __ mov(ebx, cell); | 2640 __ mov(ebx, cell); |
| 2644 | 2641 |
| 2645 CallFunctionStub stub(arg_count, flags); | 2642 CallFunctionStub stub(arg_count, flags); |
| 2646 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2643 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2647 __ CallStub(&stub, expr->CallFeedbackId()); | 2644 __ CallStub(&stub, expr->CallFeedbackId()); |
| 2648 | 2645 |
| 2649 RecordJSReturnSite(expr); | 2646 RecordJSReturnSite(expr); |
| 2650 // Restore context register. | 2647 // Restore context register. |
| 2651 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2648 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 // constructor invocation. | 2812 // constructor invocation. |
| 2816 SetSourcePosition(expr->position()); | 2813 SetSourcePosition(expr->position()); |
| 2817 | 2814 |
| 2818 // Load function and argument count into edi and eax. | 2815 // Load function and argument count into edi and eax. |
| 2819 __ Set(eax, Immediate(arg_count)); | 2816 __ Set(eax, Immediate(arg_count)); |
| 2820 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2817 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2821 | 2818 |
| 2822 // Record call targets in unoptimized code. | 2819 // Record call targets in unoptimized code. |
| 2823 Handle<Object> uninitialized = | 2820 Handle<Object> uninitialized = |
| 2824 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2821 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2825 Handle<JSGlobalPropertyCell> cell = | 2822 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
| 2826 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
| 2827 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2823 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); |
| 2828 __ mov(ebx, cell); | 2824 __ mov(ebx, cell); |
| 2829 | 2825 |
| 2830 CallConstructStub stub(RECORD_CALL_TARGET); | 2826 CallConstructStub stub(RECORD_CALL_TARGET); |
| 2831 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2827 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
| 2832 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2828 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 2833 context()->Plug(eax); | 2829 context()->Plug(eax); |
| 2834 } | 2830 } |
| 2835 | 2831 |
| 2836 | 2832 |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4922 *stack_depth = 0; | 4918 *stack_depth = 0; |
| 4923 *context_length = 0; | 4919 *context_length = 0; |
| 4924 return previous_; | 4920 return previous_; |
| 4925 } | 4921 } |
| 4926 | 4922 |
| 4927 #undef __ | 4923 #undef __ |
| 4928 | 4924 |
| 4929 } } // namespace v8::internal | 4925 } } // namespace v8::internal |
| 4930 | 4926 |
| 4931 #endif // V8_TARGET_ARCH_IA32 | 4927 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |