Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Seperate file for feedback slot allocation. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
122 InitializeFeedbackVector();
123
121 profiling_counter_ = isolate()->factory()->NewCell( 124 profiling_counter_ = isolate()->factory()->NewCell(
122 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); 125 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate()));
123 SetFunctionPosition(function()); 126 SetFunctionPosition(function());
124 Comment cmnt(masm_, "[ function compiled by full code generator"); 127 Comment cmnt(masm_, "[ function compiled by full code generator");
125 128
126 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 129 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
127 130
128 #ifdef DEBUG 131 #ifdef DEBUG
129 if (strlen(FLAG_stop_at) > 0 && 132 if (strlen(FLAG_stop_at) > 0 &&
130 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 VisitStatements(clause->statements()); 1017 VisitStatements(clause->statements());
1015 } 1018 }
1016 1019
1017 __ bind(nested_statement.break_label()); 1020 __ bind(nested_statement.break_label());
1018 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 1021 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1019 } 1022 }
1020 1023
1021 1024
1022 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { 1025 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
1023 Comment cmnt(masm_, "[ ForInStatement"); 1026 Comment cmnt(masm_, "[ ForInStatement");
1027 int slot = stmt->ForInFeedbackSlot();
1028
1024 SetStatementPosition(stmt); 1029 SetStatementPosition(stmt);
1025 1030
1026 Label loop, exit; 1031 Label loop, exit;
1027 ForIn loop_statement(this, stmt); 1032 ForIn loop_statement(this, stmt);
1028 increment_loop_depth(); 1033 increment_loop_depth();
1029 1034
1030 // Get the object to enumerate over. If the object is null or undefined, skip 1035 // Get the object to enumerate over. If the object is null or undefined, skip
1031 // over the loop. See ECMA-262 version 5, section 12.6.4. 1036 // over the loop. See ECMA-262 version 5, section 12.6.4.
1032 VisitForAccumulatorValue(stmt->enumerable()); 1037 VisitForAccumulatorValue(stmt->enumerable());
1033 __ cmp(eax, isolate()->factory()->undefined_value()); 1038 __ cmp(eax, isolate()->factory()->undefined_value());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 __ jmp(&loop); 1097 __ jmp(&loop);
1093 1098
1094 __ bind(&no_descriptors); 1099 __ bind(&no_descriptors);
1095 __ add(esp, Immediate(kPointerSize)); 1100 __ add(esp, Immediate(kPointerSize));
1096 __ jmp(&exit); 1101 __ jmp(&exit);
1097 1102
1098 // We got a fixed array in register eax. Iterate through that. 1103 // We got a fixed array in register eax. Iterate through that.
1099 Label non_proxy; 1104 Label non_proxy;
1100 __ bind(&fixed_array); 1105 __ bind(&fixed_array);
1101 1106
1102 Handle<Cell> cell = isolate()->factory()->NewCell( 1107 Handle<Object> feedback = Handle<Object>(
1103 Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), 1108 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker),
1104 isolate())); 1109 isolate());
1105 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); 1110 StoreFeedbackVectorSlot(slot, feedback);
1106 __ LoadHeapObject(ebx, cell); 1111
1107 __ mov(FieldOperand(ebx, Cell::kValueOffset), 1112 // No need for a write barrier, we are storing a Smi in the feedback vector.
1108 Immediate(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); 1113 __ LoadHeapObject(ebx, FeedbackVector());
1114 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)),
1115 Immediate(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker)));
1109 1116
1110 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check 1117 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check
1111 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object 1118 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object
1112 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); 1119 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
1113 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); 1120 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx);
1114 __ j(above, &non_proxy); 1121 __ j(above, &non_proxy);
1115 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy 1122 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy
1116 __ bind(&non_proxy); 1123 __ bind(&non_proxy);
1117 __ push(ebx); // Smi 1124 __ push(ebx); // Smi
1118 __ push(eax); // Array 1125 __ push(eax); // Array
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 int arg_count = args->length(); 2628 int arg_count = args->length();
2622 { PreservePositionScope scope(masm()->positions_recorder()); 2629 { PreservePositionScope scope(masm()->positions_recorder());
2623 for (int i = 0; i < arg_count; i++) { 2630 for (int i = 0; i < arg_count; i++) {
2624 VisitForStackValue(args->at(i)); 2631 VisitForStackValue(args->at(i));
2625 } 2632 }
2626 } 2633 }
2627 // Record source position for debugger. 2634 // Record source position for debugger.
2628 SetSourcePosition(expr->position()); 2635 SetSourcePosition(expr->position());
2629 2636
2630 Handle<Object> uninitialized = 2637 Handle<Object> uninitialized =
2631 TypeFeedbackCells::UninitializedSentinel(isolate()); 2638 TypeFeedbackInfo::UninitializedSentinel(isolate());
2632 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); 2639 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
2633 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); 2640 __ LoadHeapObject(ebx, FeedbackVector());
2634 __ mov(ebx, cell); 2641 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot())));
2635 2642
2636 // Record call targets in unoptimized code. 2643 // Record call targets in unoptimized code.
2637 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); 2644 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
2638 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2645 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2639 __ CallStub(&stub, expr->CallFeedbackId()); 2646 __ CallStub(&stub, expr->CallFeedbackId());
2640 2647
2641 RecordJSReturnSite(expr); 2648 RecordJSReturnSite(expr);
2642 // Restore context register. 2649 // Restore context register.
2643 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2650 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2644 context()->DropAndPlug(1, eax); 2651 context()->DropAndPlug(1, eax);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2805 // Call the construct call builtin that handles allocation and 2812 // Call the construct call builtin that handles allocation and
2806 // constructor invocation. 2813 // constructor invocation.
2807 SetSourcePosition(expr->position()); 2814 SetSourcePosition(expr->position());
2808 2815
2809 // Load function and argument count into edi and eax. 2816 // Load function and argument count into edi and eax.
2810 __ Set(eax, Immediate(arg_count)); 2817 __ Set(eax, Immediate(arg_count));
2811 __ mov(edi, Operand(esp, arg_count * kPointerSize)); 2818 __ mov(edi, Operand(esp, arg_count * kPointerSize));
2812 2819
2813 // Record call targets in unoptimized code. 2820 // Record call targets in unoptimized code.
2814 Handle<Object> uninitialized = 2821 Handle<Object> uninitialized =
2815 TypeFeedbackCells::UninitializedSentinel(isolate()); 2822 TypeFeedbackInfo::UninitializedSentinel(isolate());
2816 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); 2823 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized);
2817 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); 2824 __ LoadHeapObject(ebx, FeedbackVector());
2818 __ mov(ebx, cell); 2825 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot())));
2819 2826
2820 CallConstructStub stub(RECORD_CALL_TARGET); 2827 CallConstructStub stub(RECORD_CALL_TARGET);
2821 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); 2828 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
2822 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2829 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2823 context()->Plug(eax); 2830 context()->Plug(eax);
2824 } 2831 }
2825 2832
2826 2833
2827 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2834 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2828 ZoneList<Expression*>* args = expr->arguments(); 2835 ZoneList<Expression*>* args = expr->arguments();
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 4901
4895 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4902 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4896 Assembler::target_address_at(call_target_address)); 4903 Assembler::target_address_at(call_target_address));
4897 return OSR_AFTER_STACK_CHECK; 4904 return OSR_AFTER_STACK_CHECK;
4898 } 4905 }
4899 4906
4900 4907
4901 } } // namespace v8::internal 4908 } } // namespace v8::internal
4902 4909
4903 #endif // V8_TARGET_ARCH_IA32 4910 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698