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

Side by Side Diff: src/code-stubs.cc

Issue 409613002: Store both major and minor key on code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 // 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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/cpu-profiler.h" 9 #include "src/cpu-profiler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ? FindCodeInSpecialCache(&code) 182 ? FindCodeInSpecialCache(&code)
183 : FindCodeInCache(&code)) { 183 : FindCodeInCache(&code)) {
184 ASSERT(GetCodeKind() == code->kind()); 184 ASSERT(GetCodeKind() == code->kind());
185 return Handle<Code>(code); 185 return Handle<Code>(code);
186 } 186 }
187 187
188 { 188 {
189 HandleScope scope(isolate()); 189 HandleScope scope(isolate());
190 190
191 Handle<Code> new_object = GenerateCode(); 191 Handle<Code> new_object = GenerateCode();
192 new_object->set_major_key(MajorKey()); 192 new_object->set_stub_key(GetKey());
193 FinishCode(new_object); 193 FinishCode(new_object);
194 RecordCodeGeneration(new_object); 194 RecordCodeGeneration(new_object);
195 195
196 #ifdef ENABLE_DISASSEMBLER 196 #ifdef ENABLE_DISASSEMBLER
197 if (FLAG_print_code_stubs) { 197 if (FLAG_print_code_stubs) {
198 CodeTracer::Scope trace_scope(isolate()->GetCodeTracer()); 198 CodeTracer::Scope trace_scope(isolate()->GetCodeTracer());
199 OFStream os(trace_scope.file()); 199 OFStream os(trace_scope.file());
200 OStringStream name; 200 OStringStream name;
201 name << *this; 201 name << *this;
202 new_object->Disassemble(name.c_str(), os); 202 new_object->Disassemble(name.c_str(), os);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 known_map_->FindInCodeCache( 364 known_map_->FindInCodeCache(
365 strict() ? 365 strict() ?
366 *factory->strict_compare_ic_string() : 366 *factory->strict_compare_ic_string() :
367 *factory->compare_ic_string(), 367 *factory->compare_ic_string(),
368 flags), 368 flags),
369 isolate()); 369 isolate());
370 if (probe->IsCode()) { 370 if (probe->IsCode()) {
371 *code_out = Code::cast(*probe); 371 *code_out = Code::cast(*probe);
372 #ifdef DEBUG 372 #ifdef DEBUG
373 Token::Value cached_op; 373 Token::Value cached_op;
374 ICCompareStub::DecodeMinorKey((*code_out)->stub_info(), NULL, NULL, NULL, 374 ICCompareStub::DecodeKey((*code_out)->stub_key(), NULL, NULL, NULL,
375 &cached_op); 375 &cached_op);
376 ASSERT(op_ == cached_op); 376 ASSERT(op_ == cached_op);
377 #endif 377 #endif
378 return true; 378 return true;
379 } 379 }
380 return false; 380 return false;
381 } 381 }
382 382
383 383
384 int ICCompareStub::MinorKey() const { 384 int ICCompareStub::MinorKey() const {
385 return OpField::encode(op_ - Token::EQ) | 385 return OpField::encode(op_ - Token::EQ) |
386 LeftStateField::encode(left_) | 386 LeftStateField::encode(left_) |
387 RightStateField::encode(right_) | 387 RightStateField::encode(right_) |
388 HandlerStateField::encode(state_); 388 HandlerStateField::encode(state_);
389 } 389 }
390 390
391 391
392 void ICCompareStub::DecodeMinorKey(int minor_key, 392 void ICCompareStub::DecodeKey(uint32_t stub_key, CompareIC::State* left_state,
393 CompareIC::State* left_state, 393 CompareIC::State* right_state,
394 CompareIC::State* right_state, 394 CompareIC::State* handler_state,
395 CompareIC::State* handler_state, 395 Token::Value* op) {
396 Token::Value* op) { 396 int minor_key = MinorKeyFromKey(stub_key);
397 if (left_state) { 397 if (left_state) {
398 *left_state = 398 *left_state =
399 static_cast<CompareIC::State>(LeftStateField::decode(minor_key)); 399 static_cast<CompareIC::State>(LeftStateField::decode(minor_key));
400 } 400 }
401 if (right_state) { 401 if (right_state) {
402 *right_state = 402 *right_state =
403 static_cast<CompareIC::State>(RightStateField::decode(minor_key)); 403 static_cast<CompareIC::State>(RightStateField::decode(minor_key));
404 } 404 }
405 if (handler_state) { 405 if (handler_state) {
406 *handler_state = 406 *handler_state =
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 InstallDescriptor(isolate, &stub3); 990 InstallDescriptor(isolate, &stub3);
991 } 991 }
992 992
993 InternalArrayConstructorStub::InternalArrayConstructorStub( 993 InternalArrayConstructorStub::InternalArrayConstructorStub(
994 Isolate* isolate) : PlatformCodeStub(isolate) { 994 Isolate* isolate) : PlatformCodeStub(isolate) {
995 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 995 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
996 } 996 }
997 997
998 998
999 } } // namespace v8::internal 999 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/debug.cc » ('j') | src/heap-snapshot-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698