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

Side by Side Diff: src/objects.cc

Issue 10103035: Share optimized code for closures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: rebased on r11394 Created 8 years, 8 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 7900 matching lines...) Expand 10 before | Expand all | Expand 10 after
7911 // Resize the initial map and all maps in its transition tree. 7911 // Resize the initial map and all maps in its transition tree.
7912 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); 7912 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack);
7913 7913
7914 // Give the correct expected_nof_properties to initial maps created later. 7914 // Give the correct expected_nof_properties to initial maps created later.
7915 ASSERT(expected_nof_properties() >= slack); 7915 ASSERT(expected_nof_properties() >= slack);
7916 set_expected_nof_properties(expected_nof_properties() - slack); 7916 set_expected_nof_properties(expected_nof_properties() - slack);
7917 } 7917 }
7918 } 7918 }
7919 7919
7920 7920
7921 Code* SharedFunctionInfo::SearchOptimizedCodeMap(Context* global_context) {
7922 ASSERT(global_context->IsGlobalContext());
7923 Object* value = optimized_code_map();
7924 if (!value->IsSmi()) {
7925 FixedArray* optimized_code_map = FixedArray::cast(value);
7926 int length = optimized_code_map->length();
7927 for (int i = 0; i < length; i += 2) {
7928 if (optimized_code_map->get(i) == global_context) {
7929 return Code::cast(optimized_code_map->get(i + 1));
7930 }
7931 }
7932 }
7933
7934 return NULL;
7935 }
7936
7937
7921 void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) { 7938 void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) {
7922 v->VisitSharedFunctionInfo(this); 7939 v->VisitSharedFunctionInfo(this);
7923 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); 7940 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
7924 } 7941 }
7925 7942
7926 7943
7927 #define DECLARE_TAG(ignore1, name, ignore2) name, 7944 #define DECLARE_TAG(ignore1, name, ignore2) name,
7928 const char* const VisitorSynchronization::kTags[ 7945 const char* const VisitorSynchronization::kTags[
7929 VisitorSynchronization::kNumberOfSyncTags] = { 7946 VisitorSynchronization::kNumberOfSyncTags] = {
7930 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG) 7947 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
8182 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode)); 8199 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode));
8183 8200
8184 switch (opcode) { 8201 switch (opcode) {
8185 case Translation::BEGIN: 8202 case Translation::BEGIN:
8186 UNREACHABLE(); 8203 UNREACHABLE();
8187 break; 8204 break;
8188 8205
8189 case Translation::JS_FRAME: { 8206 case Translation::JS_FRAME: {
8190 int ast_id = iterator.Next(); 8207 int ast_id = iterator.Next();
8191 int function_id = iterator.Next(); 8208 int function_id = iterator.Next();
8192 JSFunction* function =
8193 JSFunction::cast(LiteralArray()->get(function_id));
8194 unsigned height = iterator.Next(); 8209 unsigned height = iterator.Next();
8195 PrintF(out, "{ast_id=%d, function=", ast_id); 8210 PrintF(out, "{ast_id=%d, function=", ast_id);
8196 function->PrintName(out); 8211 if (function_id != Translation::kSelfLiteralId) {
8212 Object* function = LiteralArray()->get(function_id);
8213 JSFunction::cast(function)->PrintName(out);
8214 } else {
8215 PrintF(out, "<self>");
8216 }
8197 PrintF(out, ", height=%u}", height); 8217 PrintF(out, ", height=%u}", height);
8198 break; 8218 break;
8199 } 8219 }
8200 8220
8201 case Translation::ARGUMENTS_ADAPTOR_FRAME: 8221 case Translation::ARGUMENTS_ADAPTOR_FRAME:
8202 case Translation::CONSTRUCT_STUB_FRAME: { 8222 case Translation::CONSTRUCT_STUB_FRAME: {
8203 int function_id = iterator.Next(); 8223 int function_id = iterator.Next();
8204 JSFunction* function = 8224 JSFunction* function =
8205 JSFunction::cast(LiteralArray()->get(function_id)); 8225 JSFunction::cast(LiteralArray()->get(function_id));
8206 unsigned height = iterator.Next(); 8226 unsigned height = iterator.Next();
(...skipping 4756 matching lines...) Expand 10 before | Expand all | Expand 10 after
12963 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 12983 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
12964 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 12984 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
12965 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 12985 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
12966 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 12986 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
12967 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 12987 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
12968 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 12988 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
12969 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 12989 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
12970 } 12990 }
12971 12991
12972 } } // namespace v8::internal 12992 } } // namespace v8::internal
OLDNEW
« src/ia32/lithium-codegen-ia32.cc ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698