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

Unified Diff: src/objects.cc

Issue 10103035: Share optimized code for closures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: added x64 and ARM ports Created 8 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 11527)
+++ src/objects.cc (working copy)
@@ -8096,6 +8096,22 @@
}
+int SharedFunctionInfo::SearchOptimizedCodeMap(Context* global_context) {
+ ASSERT(global_context->IsGlobalContext());
+ Object* value = optimized_code_map();
+ if (!value->IsSmi()) {
+ FixedArray* optimized_code_map = FixedArray::cast(value);
+ int length = optimized_code_map->length();
+ for (int i = 0; i < length; i += 3) {
+ if (optimized_code_map->get(i) == global_context) {
+ return i + 1;
+ }
+ }
+ }
+ return -1;
+}
+
+
void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) {
v->VisitSharedFunctionInfo(this);
SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
@@ -8381,11 +8397,14 @@
case Translation::JS_FRAME: {
int ast_id = iterator.Next();
int function_id = iterator.Next();
- JSFunction* function =
- JSFunction::cast(LiteralArray()->get(function_id));
unsigned height = iterator.Next();
PrintF(out, "{ast_id=%d, function=", ast_id);
- function->PrintName(out);
+ if (function_id != Translation::kSelfLiteralId) {
+ Object* function = LiteralArray()->get(function_id);
+ JSFunction::cast(function)->PrintName(out);
+ } else {
+ PrintF(out, "<self>");
+ }
PrintF(out, ", height=%u}", height);
break;
}

Powered by Google App Engine
This is Rietveld 408576698