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

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: 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 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 8078 matching lines...) Expand 10 before | Expand all | Expand 10 after
8089 // Resize the initial map and all maps in its transition tree. 8089 // Resize the initial map and all maps in its transition tree.
8090 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); 8090 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack);
8091 8091
8092 // Give the correct expected_nof_properties to initial maps created later. 8092 // Give the correct expected_nof_properties to initial maps created later.
8093 ASSERT(expected_nof_properties() >= slack); 8093 ASSERT(expected_nof_properties() >= slack);
8094 set_expected_nof_properties(expected_nof_properties() - slack); 8094 set_expected_nof_properties(expected_nof_properties() - slack);
8095 } 8095 }
8096 } 8096 }
8097 8097
8098 8098
8099 int SharedFunctionInfo::SearchOptimizedCodeMap(Context* global_context) {
8100 ASSERT(global_context->IsGlobalContext());
8101 Object* value = optimized_code_map();
8102 if (!value->IsSmi()) {
8103 FixedArray* optimized_code_map = FixedArray::cast(value);
8104 int length = optimized_code_map->length();
8105 for (int i = 0; i < length; i += 3) {
8106 if (optimized_code_map->get(i) == global_context) {
8107 return i + 1;
8108 }
8109 }
8110 }
8111 return -1;
8112 }
8113
8114
8099 void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) { 8115 void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) {
8100 v->VisitSharedFunctionInfo(this); 8116 v->VisitSharedFunctionInfo(this);
8101 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); 8117 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
8102 } 8118 }
8103 8119
8104 8120
8105 #define DECLARE_TAG(ignore1, name, ignore2) name, 8121 #define DECLARE_TAG(ignore1, name, ignore2) name,
8106 const char* const VisitorSynchronization::kTags[ 8122 const char* const VisitorSynchronization::kTags[
8107 VisitorSynchronization::kNumberOfSyncTags] = { 8123 VisitorSynchronization::kNumberOfSyncTags] = {
8108 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG) 8124 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
8374 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode)); 8390 PrintF(out, "%24s %s ", "", Translation::StringFor(opcode));
8375 8391
8376 switch (opcode) { 8392 switch (opcode) {
8377 case Translation::BEGIN: 8393 case Translation::BEGIN:
8378 UNREACHABLE(); 8394 UNREACHABLE();
8379 break; 8395 break;
8380 8396
8381 case Translation::JS_FRAME: { 8397 case Translation::JS_FRAME: {
8382 int ast_id = iterator.Next(); 8398 int ast_id = iterator.Next();
8383 int function_id = iterator.Next(); 8399 int function_id = iterator.Next();
8384 JSFunction* function =
8385 JSFunction::cast(LiteralArray()->get(function_id));
8386 unsigned height = iterator.Next(); 8400 unsigned height = iterator.Next();
8387 PrintF(out, "{ast_id=%d, function=", ast_id); 8401 PrintF(out, "{ast_id=%d, function=", ast_id);
8388 function->PrintName(out); 8402 if (function_id != Translation::kSelfLiteralId) {
8403 Object* function = LiteralArray()->get(function_id);
8404 JSFunction::cast(function)->PrintName(out);
8405 } else {
8406 PrintF(out, "<self>");
8407 }
8389 PrintF(out, ", height=%u}", height); 8408 PrintF(out, ", height=%u}", height);
8390 break; 8409 break;
8391 } 8410 }
8392 8411
8393 case Translation::ARGUMENTS_ADAPTOR_FRAME: 8412 case Translation::ARGUMENTS_ADAPTOR_FRAME:
8394 case Translation::CONSTRUCT_STUB_FRAME: { 8413 case Translation::CONSTRUCT_STUB_FRAME: {
8395 int function_id = iterator.Next(); 8414 int function_id = iterator.Next();
8396 JSFunction* function = 8415 JSFunction* function =
8397 JSFunction::cast(LiteralArray()->get(function_id)); 8416 JSFunction::cast(LiteralArray()->get(function_id));
8398 unsigned height = iterator.Next(); 8417 unsigned height = iterator.Next();
(...skipping 4764 matching lines...) Expand 10 before | Expand all | Expand 10 after
13163 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13182 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13164 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13183 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13165 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13184 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13166 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13185 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13167 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13186 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13168 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13187 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13169 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13188 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13170 } 13189 }
13171 13190
13172 } } // namespace v8::internal 13191 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698