OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // - jssp: stack pointer. | 145 // - jssp: stack pointer. |
146 // - lr: return address. | 146 // - lr: return address. |
147 // | 147 // |
148 // The function builds a JS frame. See JavaScriptFrameConstants in | 148 // The function builds a JS frame. See JavaScriptFrameConstants in |
149 // frames-arm.h for its layout. | 149 // frames-arm.h for its layout. |
150 void FullCodeGenerator::Generate() { | 150 void FullCodeGenerator::Generate() { |
151 CompilationInfo* info = info_; | 151 CompilationInfo* info = info_; |
152 handler_table_ = | 152 handler_table_ = |
153 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 153 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
154 | 154 |
155 InitializeFeedbackVector(); | |
156 | |
157 profiling_counter_ = isolate()->factory()->NewCell( | 155 profiling_counter_ = isolate()->factory()->NewCell( |
158 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 156 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
159 SetFunctionPosition(function()); | 157 SetFunctionPosition(function()); |
160 Comment cmnt(masm_, "[ Function compiled by full code generator"); | 158 Comment cmnt(masm_, "[ Function compiled by full code generator"); |
161 | 159 |
162 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 160 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
163 | 161 |
164 #ifdef DEBUG | 162 #ifdef DEBUG |
165 if (strlen(FLAG_stop_at) > 0 && | 163 if (strlen(FLAG_stop_at) > 0 && |
166 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 164 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 __ Push(x2, x1, x0); | 1195 __ Push(x2, x1, x0); |
1198 __ B(&loop); | 1196 __ B(&loop); |
1199 | 1197 |
1200 __ Bind(&no_descriptors); | 1198 __ Bind(&no_descriptors); |
1201 __ Drop(1); | 1199 __ Drop(1); |
1202 __ B(&exit); | 1200 __ B(&exit); |
1203 | 1201 |
1204 // We got a fixed array in register x0. Iterate through that. | 1202 // We got a fixed array in register x0. Iterate through that. |
1205 __ Bind(&fixed_array); | 1203 __ Bind(&fixed_array); |
1206 | 1204 |
1207 Handle<Object> feedback = Handle<Object>( | |
1208 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), | |
1209 isolate()); | |
1210 StoreFeedbackVectorSlot(slot, feedback); | |
1211 __ LoadObject(x1, FeedbackVector()); | 1205 __ LoadObject(x1, FeedbackVector()); |
1212 __ Mov(x10, Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker)); | 1206 __ Mov(x10, Operand(TypeFeedbackInfo::MegamorphicSentinel(isolate()))); |
1213 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(slot))); | 1207 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(slot))); |
1214 | 1208 |
1215 __ Mov(x1, Smi::FromInt(1)); // Smi indicates slow check. | 1209 __ Mov(x1, Smi::FromInt(1)); // Smi indicates slow check. |
1216 __ Peek(x10, 0); // Get enumerated object. | 1210 __ Peek(x10, 0); // Get enumerated object. |
1217 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1211 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1218 // TODO(all): similar check was done already. Can we avoid it here? | 1212 // TODO(all): similar check was done already. Can we avoid it here? |
1219 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); | 1213 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); |
1220 ASSERT(Smi::FromInt(0) == 0); | 1214 ASSERT(Smi::FromInt(0) == 0); |
1221 __ CzeroX(x1, le); // Zero indicates proxy. | 1215 __ CzeroX(x1, le); // Zero indicates proxy. |
1222 __ Push(x1, x0); // Smi and array | 1216 __ Push(x1, x0); // Smi and array |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 ZoneList<Expression*>* args = expr->arguments(); | 2416 ZoneList<Expression*>* args = expr->arguments(); |
2423 int arg_count = args->length(); | 2417 int arg_count = args->length(); |
2424 { PreservePositionScope scope(masm()->positions_recorder()); | 2418 { PreservePositionScope scope(masm()->positions_recorder()); |
2425 for (int i = 0; i < arg_count; i++) { | 2419 for (int i = 0; i < arg_count; i++) { |
2426 VisitForStackValue(args->at(i)); | 2420 VisitForStackValue(args->at(i)); |
2427 } | 2421 } |
2428 } | 2422 } |
2429 // Record source position for debugger. | 2423 // Record source position for debugger. |
2430 SetSourcePosition(expr->position()); | 2424 SetSourcePosition(expr->position()); |
2431 | 2425 |
2432 Handle<Object> uninitialized = | |
2433 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2434 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
2435 __ LoadObject(x2, FeedbackVector()); | 2426 __ LoadObject(x2, FeedbackVector()); |
2436 __ Mov(x3, Smi::FromInt(expr->CallFeedbackSlot())); | 2427 __ Mov(x3, Smi::FromInt(expr->CallFeedbackSlot())); |
2437 | 2428 |
2438 // Record call targets in unoptimized code. | 2429 // Record call targets in unoptimized code. |
2439 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET); | 2430 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET); |
2440 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2431 __ Peek(x1, (arg_count + 1) * kXRegSize); |
2441 __ CallStub(&stub); | 2432 __ CallStub(&stub); |
2442 RecordJSReturnSite(expr); | 2433 RecordJSReturnSite(expr); |
2443 // Restore context register. | 2434 // Restore context register. |
2444 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2435 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 | 2612 |
2622 // Call the construct call builtin that handles allocation and | 2613 // Call the construct call builtin that handles allocation and |
2623 // constructor invocation. | 2614 // constructor invocation. |
2624 SetSourcePosition(expr->position()); | 2615 SetSourcePosition(expr->position()); |
2625 | 2616 |
2626 // Load function and argument count into x1 and x0. | 2617 // Load function and argument count into x1 and x0. |
2627 __ Mov(x0, arg_count); | 2618 __ Mov(x0, arg_count); |
2628 __ Peek(x1, arg_count * kXRegSize); | 2619 __ Peek(x1, arg_count * kXRegSize); |
2629 | 2620 |
2630 // Record call targets in unoptimized code. | 2621 // Record call targets in unoptimized code. |
2631 Handle<Object> uninitialized = | |
2632 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2633 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
2634 if (FLAG_pretenuring_call_new) { | 2622 if (FLAG_pretenuring_call_new) { |
2635 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), | 2623 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
2636 isolate()->factory()->NewAllocationSite()); | |
2637 ASSERT(expr->AllocationSiteFeedbackSlot() == | 2624 ASSERT(expr->AllocationSiteFeedbackSlot() == |
2638 expr->CallNewFeedbackSlot() + 1); | 2625 expr->CallNewFeedbackSlot() + 1); |
2639 } | 2626 } |
2640 | 2627 |
2641 __ LoadObject(x2, FeedbackVector()); | 2628 __ LoadObject(x2, FeedbackVector()); |
2642 __ Mov(x3, Smi::FromInt(expr->CallNewFeedbackSlot())); | 2629 __ Mov(x3, Smi::FromInt(expr->CallNewFeedbackSlot())); |
2643 | 2630 |
2644 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); | 2631 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); |
2645 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2632 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2646 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2633 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4982 return previous_; | 4969 return previous_; |
4983 } | 4970 } |
4984 | 4971 |
4985 | 4972 |
4986 #undef __ | 4973 #undef __ |
4987 | 4974 |
4988 | 4975 |
4989 } } // namespace v8::internal | 4976 } } // namespace v8::internal |
4990 | 4977 |
4991 #endif // V8_TARGET_ARCH_ARM64 | 4978 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |