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

Side by Side Diff: src/ic/ic.cc

Issue 1162993006: Add support for Embedded Constant Pools for PPC and Arm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-inl.h » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool for_queries_only) 143 bool for_queries_only)
144 : isolate_(isolate), 144 : isolate_(isolate),
145 target_set_(false), 145 target_set_(false),
146 vector_set_(false), 146 vector_set_(false),
147 target_maps_set_(false), 147 target_maps_set_(false),
148 nexus_(nexus) { 148 nexus_(nexus) {
149 // To improve the performance of the (much used) IC code, we unfold a few 149 // To improve the performance of the (much used) IC code, we unfold a few
150 // levels of the stack frame iteration code. This yields a ~35% speedup when 150 // levels of the stack frame iteration code. This yields a ~35% speedup when
151 // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag. 151 // running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic' flag.
152 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top()); 152 const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
153 Address constant_pool = NULL; 153 Address* constant_pool = NULL;
154 if (FLAG_enable_ool_constant_pool) { 154 if (FLAG_enable_embedded_constant_pool) {
155 constant_pool = 155 constant_pool = reinterpret_cast<Address*>(
156 Memory::Address_at(entry + ExitFrameConstants::kConstantPoolOffset); 156 entry + ExitFrameConstants::kConstantPoolOffset);
157 } 157 }
158 Address* pc_address = 158 Address* pc_address =
159 reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset); 159 reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
160 Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset); 160 Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
161 // If there's another JavaScript frame on the stack or a 161 // If there's another JavaScript frame on the stack or a
162 // StubFailureTrampoline, we need to look one frame further down the stack to 162 // StubFailureTrampoline, we need to look one frame further down the stack to
163 // find the frame pointer and the return address stack slot. 163 // find the frame pointer and the return address stack slot.
164 if (depth == EXTRA_CALL_FRAME) { 164 if (depth == EXTRA_CALL_FRAME) {
165 if (FLAG_enable_ool_constant_pool) { 165 if (FLAG_enable_embedded_constant_pool) {
166 constant_pool = 166 constant_pool = reinterpret_cast<Address*>(
167 Memory::Address_at(fp + StandardFrameConstants::kConstantPoolOffset); 167 fp + StandardFrameConstants::kConstantPoolOffset);
168 } 168 }
169 const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset; 169 const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
170 pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset); 170 pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
171 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); 171 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
172 } 172 }
173 #ifdef DEBUG 173 #ifdef DEBUG
174 StackFrameIterator it(isolate); 174 StackFrameIterator it(isolate);
175 for (int i = 0; i < depth + 1; i++) it.Advance(); 175 for (int i = 0; i < depth + 1; i++) it.Advance();
176 StackFrame* frame = it.frame(); 176 StackFrame* frame = it.frame();
177 DCHECK(fp == frame->fp() && pc_address == frame->pc_address()); 177 DCHECK(fp == frame->fp() && pc_address == frame->pc_address());
178 #endif 178 #endif
179 fp_ = fp; 179 fp_ = fp;
180 if (FLAG_enable_ool_constant_pool) { 180 if (FLAG_enable_embedded_constant_pool) {
181 raw_constant_pool_ = handle( 181 constant_pool_address_ = constant_pool;
182 ConstantPoolArray::cast(reinterpret_cast<Object*>(constant_pool)),
183 isolate);
184 } 182 }
185 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); 183 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
186 target_ = handle(raw_target(), isolate); 184 target_ = handle(raw_target(), isolate);
187 kind_ = target_->kind(); 185 kind_ = target_->kind();
188 state_ = (!for_queries_only && UseVector()) ? nexus->StateFromFeedback() 186 state_ = (!for_queries_only && UseVector()) ? nexus->StateFromFeedback()
189 : target_->ic_state(); 187 : target_->ic_state();
190 old_state_ = state_; 188 old_state_ = state_;
191 extra_ic_state_ = target_->extra_ic_state(); 189 extra_ic_state_ = target_->extra_ic_state();
192 } 190 }
193 191
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 old_state = old_target->ic_state(); 470 old_state = old_target->ic_state();
473 new_state = target->ic_state(); 471 new_state = target->ic_state();
474 target_remains_ic_stub = true; 472 target_remains_ic_stub = true;
475 } 473 }
476 474
477 OnTypeFeedbackChanged(isolate, address, old_state, new_state, 475 OnTypeFeedbackChanged(isolate, address, old_state, new_state,
478 target_remains_ic_stub); 476 target_remains_ic_stub);
479 } 477 }
480 478
481 479
482 void IC::Clear(Isolate* isolate, Address address, 480 void IC::Clear(Isolate* isolate, Address address, Address constant_pool) {
483 ConstantPoolArray* constant_pool) {
484 Code* target = GetTargetAtAddress(address, constant_pool); 481 Code* target = GetTargetAtAddress(address, constant_pool);
485 482
486 // Don't clear debug break inline cache as it will remove the break point. 483 // Don't clear debug break inline cache as it will remove the break point.
487 if (target->is_debug_stub()) return; 484 if (target->is_debug_stub()) return;
488 485
489 switch (target->kind()) { 486 switch (target->kind()) {
490 case Code::LOAD_IC: 487 case Code::LOAD_IC:
491 case Code::KEYED_LOAD_IC: 488 case Code::KEYED_LOAD_IC:
492 return; 489 return;
493 case Code::STORE_IC: 490 case Code::STORE_IC:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 533
537 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) { 534 void LoadIC::Clear(Isolate* isolate, Code* host, LoadICNexus* nexus) {
538 if (IsCleared(nexus)) return; 535 if (IsCleared(nexus)) return;
539 State state = nexus->StateFromFeedback(); 536 State state = nexus->StateFromFeedback();
540 nexus->ConfigurePremonomorphic(); 537 nexus->ConfigurePremonomorphic();
541 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, PREMONOMORPHIC); 538 OnTypeFeedbackChanged(isolate, host, nexus->vector(), state, PREMONOMORPHIC);
542 } 539 }
543 540
544 541
545 void StoreIC::Clear(Isolate* isolate, Address address, Code* target, 542 void StoreIC::Clear(Isolate* isolate, Address address, Code* target,
546 ConstantPoolArray* constant_pool) { 543 Address constant_pool) {
547 if (IsCleared(target)) return; 544 if (IsCleared(target)) return;
548 Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::STORE_IC, 545 Code* code = PropertyICCompiler::FindPreMonomorphic(isolate, Code::STORE_IC,
549 target->extra_ic_state()); 546 target->extra_ic_state());
550 SetTargetAtAddress(address, code, constant_pool); 547 SetTargetAtAddress(address, code, constant_pool);
551 } 548 }
552 549
553 550
554 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target, 551 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target,
555 ConstantPoolArray* constant_pool) { 552 Address constant_pool) {
556 if (IsCleared(target)) return; 553 if (IsCleared(target)) return;
557 Handle<Code> code = pre_monomorphic_stub( 554 Handle<Code> code = pre_monomorphic_stub(
558 isolate, StoreICState::GetLanguageMode(target->extra_ic_state())); 555 isolate, StoreICState::GetLanguageMode(target->extra_ic_state()));
559 SetTargetAtAddress(address, *code, constant_pool); 556 SetTargetAtAddress(address, *code, constant_pool);
560 } 557 }
561 558
562 559
563 void CompareIC::Clear(Isolate* isolate, Address address, Code* target, 560 void CompareIC::Clear(Isolate* isolate, Address address, Code* target,
564 ConstantPoolArray* constant_pool) { 561 Address constant_pool) {
565 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC); 562 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC);
566 CompareICStub stub(target->stub_key(), isolate); 563 CompareICStub stub(target->stub_key(), isolate);
567 // Only clear CompareICs that can retain objects. 564 // Only clear CompareICs that can retain objects.
568 if (stub.state() != CompareICState::KNOWN_OBJECT) return; 565 if (stub.state() != CompareICState::KNOWN_OBJECT) return;
569 SetTargetAtAddress(address, 566 SetTargetAtAddress(address,
570 GetRawUninitialized(isolate, stub.op(), stub.strong()), 567 GetRawUninitialized(isolate, stub.op(), stub.strong()),
571 constant_pool); 568 constant_pool);
572 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); 569 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
573 } 570 }
574 571
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 // Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc. 2595 // Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc.
2599 RUNTIME_FUNCTION(CompareIC_Miss) { 2596 RUNTIME_FUNCTION(CompareIC_Miss) {
2600 TimerEventScope<TimerEventIcMiss> timer(isolate); 2597 TimerEventScope<TimerEventIcMiss> timer(isolate);
2601 HandleScope scope(isolate); 2598 HandleScope scope(isolate);
2602 DCHECK(args.length() == 3); 2599 DCHECK(args.length() == 3);
2603 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); 2600 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2)));
2604 return ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); 2601 return ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1));
2605 } 2602 }
2606 2603
2607 2604
2608 void CompareNilIC::Clear(Address address, Code* target, 2605 void CompareNilIC::Clear(Address address, Code* target, Address constant_pool) {
2609 ConstantPoolArray* constant_pool) {
2610 if (IsCleared(target)) return; 2606 if (IsCleared(target)) return;
2611 ExtraICState state = target->extra_ic_state(); 2607 ExtraICState state = target->extra_ic_state();
2612 2608
2613 CompareNilICStub stub(target->GetIsolate(), state, 2609 CompareNilICStub stub(target->GetIsolate(), state,
2614 HydrogenCodeStub::UNINITIALIZED); 2610 HydrogenCodeStub::UNINITIALIZED);
2615 stub.ClearState(); 2611 stub.ClearState();
2616 2612
2617 Code* code = NULL; 2613 Code* code = NULL;
2618 CHECK(stub.FindCodeInCache(&code)); 2614 CHECK(stub.FindCodeInCache(&code));
2619 2615
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2901 static const Address IC_utilities[] = { 2897 static const Address IC_utilities[] = {
2902 #define ADDR(name) FUNCTION_ADDR(name), 2898 #define ADDR(name) FUNCTION_ADDR(name),
2903 IC_UTIL_LIST(ADDR) NULL 2899 IC_UTIL_LIST(ADDR) NULL
2904 #undef ADDR 2900 #undef ADDR
2905 }; 2901 };
2906 2902
2907 2903
2908 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2904 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2909 } // namespace internal 2905 } // namespace internal
2910 } // namespace v8 2906 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-inl.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698