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

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

Issue 14862009: Encapsulating Type information in the CompareICStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 case CompareIC::KNOWN_OBJECT: 400 case CompareIC::KNOWN_OBJECT:
401 ASSERT(*known_map_ != NULL); 401 ASSERT(*known_map_ != NULL);
402 GenerateKnownObjects(masm); 402 GenerateKnownObjects(masm);
403 break; 403 break;
404 case CompareIC::GENERIC: 404 case CompareIC::GENERIC:
405 GenerateGeneric(masm); 405 GenerateGeneric(masm);
406 break; 406 break;
407 } 407 }
408 } 408 }
409 409
410 410 void CompareNilICStub::Record(Handle<Object> object) {
411 CompareNilICStub::Types CompareNilICStub::GetPatchedICFlags( 411 ASSERT(!types_.IsFullCompare());
412 Code::ExtraICState extra_ic_state, 412 if (IsStrictEquality()) {
413 Handle<Object> object, 413 if (IsNullValue()) {
414 bool* already_monomorphic) { 414 types_.SetTo(NULL_TYPE);
415 Types types = TypesField::decode(extra_ic_state);
416 NilValue nil = NilValueField::decode(extra_ic_state);
417 EqualityKind kind = EqualityKindField::decode(extra_ic_state);
418 ASSERT(types != CompareNilICStub::kFullCompare);
419 *already_monomorphic =
420 (types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0;
421 if (kind == kStrictEquality) {
422 if (nil == kNullValue) {
423 return CompareNilICStub::kCompareAgainstNull;
424 } else { 415 } else {
425 return CompareNilICStub::kCompareAgainstUndefined; 416 types_.SetTo(UNDEFINED);
426 } 417 }
427 } else { 418 } else {
428 if (object->IsNull()) { 419 if (object->IsNull()) {
429 types = static_cast<CompareNilICStub::Types>( 420 types_.Add(NULL_TYPE);
430 types | CompareNilICStub::kCompareAgainstNull);
431 } else if (object->IsUndefined()) { 421 } else if (object->IsUndefined()) {
432 types = static_cast<CompareNilICStub::Types>( 422 types_.Add(UNDEFINED);
433 types | CompareNilICStub::kCompareAgainstUndefined);
434 } else if (object->IsUndetectableObject() || 423 } else if (object->IsUndetectableObject() ||
435 object->IsOddball() || 424 object->IsOddball() ||
436 !object->IsHeapObject()) { 425 !object->IsHeapObject()) {
437 types = CompareNilICStub::kFullCompare; 426 types_.BeFullCompare();
438 } else if ((types & CompareNilICStub::kCompareAgainstMonomorphicMap) != 0) { 427 } else if (IsMonomorphic()) {
439 types = CompareNilICStub::kFullCompare; 428 types_.BeFullCompare();
440 } else { 429 } else {
441 types = static_cast<CompareNilICStub::Types>( 430 types_.Add(MONOMORPHIC_MAP);
442 types | CompareNilICStub::kCompareAgainstMonomorphicMap);
443 } 431 }
444 } 432 }
445 return types;
446 } 433 }
447 434
435 void CompareNilICStub::Types::Add(Type type) {
436 set_.Add(type);
437 }
438
439 void CompareNilICStub::Types::SetTo(Type type) {
440 Clear();
441 Add(type);
442 }
443
444 void CompareNilICStub::PrintName(StringStream* stream) {
445 stream->Add("CompareNilICStub_");
446 types_.Print(stream);
447 if (IsNullValue()) {
448 stream->Add("(NullValue|");
449 } else {
450 stream->Add("(UndefinedValue|");
451 }
452 if (IsStrictEquality()) {
453 stream->Add("StrictEquality)");
454 } else {
455 stream->Add("NonStrictEquality)");
456 }
457 }
458
459 void CompareNilICStub::Types::Print(StringStream* stream) const {
Sven Panne 2013/05/13 14:24:50 This doesn't produce very readable output when Typ
oliv 2013/05/13 18:03:58 ok, done
460 if (IsEmpty()) stream->Add("None");
461 if (Contains(UNDEFINED)) stream->Add("Undefined");
462 if (Contains(NULL_TYPE)) stream->Add("Null");
463 if (Contains(MONOMORPHIC_MAP)) stream->Add("MonomorphicMap");
464 if (Contains(UNDETECTABLE)) stream->Add("Undetectable");
465 }
448 466
449 void InstanceofStub::PrintName(StringStream* stream) { 467 void InstanceofStub::PrintName(StringStream* stream) {
450 const char* args = ""; 468 const char* args = "";
451 if (HasArgsInRegisters()) { 469 if (HasArgsInRegisters()) {
452 args = "_REGS"; 470 args = "_REGS";
453 } 471 }
454 472
455 const char* inline_check = ""; 473 const char* inline_check = "";
456 if (HasCallSiteInlineCheck()) { 474 if (HasCallSiteInlineCheck()) {
457 inline_check = "_INLINE"; 475 inline_check = "_INLINE";
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } else if (argument_count >= 2) { 749 } else if (argument_count >= 2) {
732 argument_count_ = MORE_THAN_ONE; 750 argument_count_ = MORE_THAN_ONE;
733 } else { 751 } else {
734 UNREACHABLE(); 752 UNREACHABLE();
735 } 753 }
736 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 754 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
737 } 755 }
738 756
739 757
740 } } // namespace v8::internal 758 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698