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

Unified Diff: src/ic.cc

Issue 8187: Serendipitously arrange the tags so that String.length() becomes a branch-fre... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: src/ic.cc
===================================================================
--- src/ic.cc (revision 595)
+++ src/ic.cc (working copy)
@@ -459,14 +459,7 @@
if (FLAG_trace_ic) PrintF("[LoadIC : +#length /string]\n");
#endif
Code* target = NULL;
- if (object->IsShortString()) {
- target = Builtins::builtin(Builtins::LoadIC_ShortStringLength);
- } else if (object->IsMediumString()) {
- target = Builtins::builtin(Builtins::LoadIC_MediumStringLength);
- } else {
- ASSERT(object->IsLongString());
- target = Builtins::builtin(Builtins::LoadIC_LongStringLength);
- }
+ target = Builtins::builtin(Builtins::LoadIC_StringLength);
set_target(target);
StubCache::Set(*name, HeapObject::cast(*object)->map(), target);
return Smi::FromInt(String::cast(*object)->length());
@@ -637,15 +630,7 @@
if (object->IsString() && name->Equals(Heap::length_symbol())) {
Handle<String> string = Handle<String>::cast(object);
Object* code = NULL;
- if (string->IsShortString()) {
- code = StubCache::ComputeKeyedLoadShortStringLength(*name, *string);
- } else if (string->IsMediumString()) {
- code =
- StubCache::ComputeKeyedLoadMediumStringLength(*name, *string);
- } else {
- ASSERT(string->IsLongString());
- code = StubCache::ComputeKeyedLoadLongStringLength(*name, *string);
- }
+ code = StubCache::ComputeKeyedLoadStringLength(*name, *string);
if (code->IsFailure()) return code;
set_target(Code::cast(code));
#ifdef DEBUG

Powered by Google App Engine
This is Rietveld 408576698