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

Unified Diff: src/serialize.cc

Issue 395823002: Store builtin index on the builtin code object. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index eedbab4cd6e0f50053288dfa73d2f69056f9a2da..37c21bc550726b851015ae6711b68795f27cd9f8 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1937,6 +1937,7 @@ void CodeSerializer::SerializeObject(Object* o, HowToCode how_to_code,
SerializeBuiltin(code_object, how_to_code, where_to_point, skip);
return;
}
+ // TODO(yangguo) figure out whether other code kinds can be handled smarter.
}
if (heap_object == source_) {
@@ -1964,15 +1965,11 @@ void CodeSerializer::SerializeBuiltin(Code* builtin, HowToCode how_to_code,
ASSERT((how_to_code == kPlain && where_to_point == kStartOfObject) ||
(how_to_code == kFromCode && where_to_point == kInnerPointer));
- int id = 0;
- do { // Look for existing builtins in the list.
- Code* b = isolate()->builtins()->builtin(static_cast<Builtins::Name>(id));
- if (builtin == b) break;
- } while (++id < Builtins::builtin_count);
- ASSERT(id < Builtins::builtin_count); // We must have found a one.
-
+ int builtin_index = builtin->builtin_index();
+ ASSERT_LT(builtin_index, Builtins::builtin_count);
+ ASSERT_LE(0, builtin_index);
sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin");
- sink_->PutInt(id, "builtin_index");
+ sink_->PutInt(builtin_index, "builtin_index");
}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698