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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // o fp: our caller's frame pointer | 122 // o fp: our caller's frame pointer |
123 // o sp: stack pointer | 123 // o sp: stack pointer |
124 // o lr: return address | 124 // o lr: return address |
125 // | 125 // |
126 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 126 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
127 // frames-arm.h for its layout. | 127 // frames-arm.h for its layout. |
128 void FullCodeGenerator::Generate() { | 128 void FullCodeGenerator::Generate() { |
129 CompilationInfo* info = info_; | 129 CompilationInfo* info = info_; |
130 handler_table_ = | 130 handler_table_ = |
131 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 131 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
132 profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( | 132 profiling_counter_ = isolate()->factory()->NewCell( |
133 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 133 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
134 SetFunctionPosition(function()); | 134 SetFunctionPosition(function()); |
135 Comment cmnt(masm_, "[ function compiled by full code generator"); | 135 Comment cmnt(masm_, "[ function compiled by full code generator"); |
136 | 136 |
137 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 137 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
138 | 138 |
139 #ifdef DEBUG | 139 #ifdef DEBUG |
140 if (strlen(FLAG_stop_at) > 0 && | 140 if (strlen(FLAG_stop_at) > 0 && |
141 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 141 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
142 __ stop("stop-at"); | 142 __ stop("stop-at"); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 void FullCodeGenerator::ClearAccumulator() { | 323 void FullCodeGenerator::ClearAccumulator() { |
324 __ mov(r0, Operand(Smi::FromInt(0))); | 324 __ mov(r0, Operand(Smi::FromInt(0))); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 328 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
329 __ mov(r2, Operand(profiling_counter_)); | 329 __ mov(r2, Operand(profiling_counter_)); |
330 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 330 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
331 __ sub(r3, r3, Operand(Smi::FromInt(delta)), SetCC); | 331 __ sub(r3, r3, Operand(Smi::FromInt(delta)), SetCC); |
332 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 332 __ str(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
333 } | 333 } |
334 | 334 |
335 | 335 |
336 void FullCodeGenerator::EmitProfilingCounterReset() { | 336 void FullCodeGenerator::EmitProfilingCounterReset() { |
337 int reset_value = FLAG_interrupt_budget; | 337 int reset_value = FLAG_interrupt_budget; |
338 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { | 338 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { |
339 // Self-optimization is a one-off thing: if it fails, don't try again. | 339 // Self-optimization is a one-off thing: if it fails, don't try again. |
340 reset_value = Smi::kMaxValue; | 340 reset_value = Smi::kMaxValue; |
341 } | 341 } |
342 if (isolate()->IsDebuggerActive()) { | 342 if (isolate()->IsDebuggerActive()) { |
343 // Detect debug break requests as soon as possible. | 343 // Detect debug break requests as soon as possible. |
344 reset_value = FLAG_interrupt_budget >> 4; | 344 reset_value = FLAG_interrupt_budget >> 4; |
345 } | 345 } |
346 __ mov(r2, Operand(profiling_counter_)); | 346 __ mov(r2, Operand(profiling_counter_)); |
347 __ mov(r3, Operand(Smi::FromInt(reset_value))); | 347 __ mov(r3, Operand(Smi::FromInt(reset_value))); |
348 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 348 __ str(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
349 } | 349 } |
350 | 350 |
351 | 351 |
352 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 352 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
353 Label* back_edge_target) { | 353 Label* back_edge_target) { |
354 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 354 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
355 // Block literal pools whilst emitting back edge code. | 355 // Block literal pools whilst emitting back edge code. |
356 Assembler::BlockConstPoolScope block_const_pool(masm_); | 356 Assembler::BlockConstPoolScope block_const_pool(masm_); |
357 Label ok; | 357 Label ok; |
358 | 358 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 __ jmp(&loop); | 1157 __ jmp(&loop); |
1158 | 1158 |
1159 __ bind(&no_descriptors); | 1159 __ bind(&no_descriptors); |
1160 __ Drop(1); | 1160 __ Drop(1); |
1161 __ jmp(&exit); | 1161 __ jmp(&exit); |
1162 | 1162 |
1163 // We got a fixed array in register r0. Iterate through that. | 1163 // We got a fixed array in register r0. Iterate through that. |
1164 Label non_proxy; | 1164 Label non_proxy; |
1165 __ bind(&fixed_array); | 1165 __ bind(&fixed_array); |
1166 | 1166 |
1167 Handle<JSGlobalPropertyCell> cell = | 1167 Handle<Cell> cell = isolate()->factory()->NewCell( |
1168 isolate()->factory()->NewJSGlobalPropertyCell( | 1168 Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), |
1169 Handle<Object>( | 1169 isolate())); |
1170 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), | |
1171 isolate())); | |
1172 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); | 1170 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); |
1173 __ LoadHeapObject(r1, cell); | 1171 __ LoadHeapObject(r1, cell); |
1174 __ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); | 1172 __ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); |
1175 __ str(r2, FieldMemOperand(r1, JSGlobalPropertyCell::kValueOffset)); | 1173 __ str(r2, FieldMemOperand(r1, Cell::kValueOffset)); |
1176 | 1174 |
1177 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1175 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1178 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1176 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1179 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1177 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1180 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); | 1178 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); |
1181 __ b(gt, &non_proxy); | 1179 __ b(gt, &non_proxy); |
1182 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1180 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1183 __ bind(&non_proxy); | 1181 __ bind(&non_proxy); |
1184 __ Push(r1, r0); // Smi and array | 1182 __ Push(r1, r0); // Smi and array |
1185 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1183 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 VisitForStackValue(args->at(i)); | 2674 VisitForStackValue(args->at(i)); |
2677 } | 2675 } |
2678 } | 2676 } |
2679 // Record source position for debugger. | 2677 // Record source position for debugger. |
2680 SetSourcePosition(expr->position()); | 2678 SetSourcePosition(expr->position()); |
2681 | 2679 |
2682 // Record call targets in unoptimized code. | 2680 // Record call targets in unoptimized code. |
2683 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2681 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2684 Handle<Object> uninitialized = | 2682 Handle<Object> uninitialized = |
2685 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2683 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2686 Handle<JSGlobalPropertyCell> cell = | 2684 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
2687 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
2688 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2685 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
2689 __ mov(r2, Operand(cell)); | 2686 __ mov(r2, Operand(cell)); |
2690 | 2687 |
2691 CallFunctionStub stub(arg_count, flags); | 2688 CallFunctionStub stub(arg_count, flags); |
2692 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2689 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2693 __ CallStub(&stub, expr->CallFeedbackId()); | 2690 __ CallStub(&stub, expr->CallFeedbackId()); |
2694 RecordJSReturnSite(expr); | 2691 RecordJSReturnSite(expr); |
2695 // Restore context register. | 2692 // Restore context register. |
2696 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2693 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2697 context()->DropAndPlug(1, r0); | 2694 context()->DropAndPlug(1, r0); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 // constructor invocation. | 2869 // constructor invocation. |
2873 SetSourcePosition(expr->position()); | 2870 SetSourcePosition(expr->position()); |
2874 | 2871 |
2875 // Load function and argument count into r1 and r0. | 2872 // Load function and argument count into r1 and r0. |
2876 __ mov(r0, Operand(arg_count)); | 2873 __ mov(r0, Operand(arg_count)); |
2877 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 2874 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
2878 | 2875 |
2879 // Record call targets in unoptimized code. | 2876 // Record call targets in unoptimized code. |
2880 Handle<Object> uninitialized = | 2877 Handle<Object> uninitialized = |
2881 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2878 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2882 Handle<JSGlobalPropertyCell> cell = | 2879 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
2883 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
2884 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2880 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); |
2885 __ mov(r2, Operand(cell)); | 2881 __ mov(r2, Operand(cell)); |
2886 | 2882 |
2887 CallConstructStub stub(RECORD_CALL_TARGET); | 2883 CallConstructStub stub(RECORD_CALL_TARGET); |
2888 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2884 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2889 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2885 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2890 context()->Plug(r0); | 2886 context()->Plug(r0); |
2891 } | 2887 } |
2892 | 2888 |
2893 | 2889 |
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4925 *context_length = 0; | 4921 *context_length = 0; |
4926 return previous_; | 4922 return previous_; |
4927 } | 4923 } |
4928 | 4924 |
4929 | 4925 |
4930 #undef __ | 4926 #undef __ |
4931 | 4927 |
4932 } } // namespace v8::internal | 4928 } } // namespace v8::internal |
4933 | 4929 |
4934 #endif // V8_TARGET_ARCH_ARM | 4930 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |