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

Side by Side Diff: src/execution.cc

Issue 17354: Do not cache functions until we know they are fully constructed. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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
« src/apinatives.js ('K') | « src/apinatives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return result; 432 return result;
433 } 433 }
434 434
435 435
436 Handle<JSFunction> Execution::InstantiateFunction( 436 Handle<JSFunction> Execution::InstantiateFunction(
437 Handle<FunctionTemplateInfo> data, bool* exc) { 437 Handle<FunctionTemplateInfo> data, bool* exc) {
438 // Fast case: see if the function has already been instantiated 438 // Fast case: see if the function has already been instantiated
439 int serial_number = Smi::cast(data->serial_number())->value(); 439 int serial_number = Smi::cast(data->serial_number())->value();
440 Object* elm = 440 Object* elm =
441 Top::global_context()->function_cache()->GetElement(serial_number); 441 Top::global_context()->function_cache()->GetElement(serial_number);
442 if (!elm->IsUndefined()) return Handle<JSFunction>(JSFunction::cast(elm)); 442 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
443 // The function has not yet been instantiated in this context; do it. 443 // The function has not yet been instantiated in this context; do it.
444 Object** args[1] = { Handle<Object>::cast(data).location() }; 444 Object** args[1] = { Handle<Object>::cast(data).location() };
445 Handle<Object> result = 445 Handle<Object> result =
446 Call(Top::instantiate_fun(), Top::builtins(), 1, args, exc); 446 Call(Top::instantiate_fun(), Top::builtins(), 1, args, exc);
447 if (*exc) return Handle<JSFunction>::null(); 447 if (*exc) return Handle<JSFunction>::null();
448 return Handle<JSFunction>::cast(result); 448 return Handle<JSFunction>::cast(result);
449 } 449 }
450 450
451 451
452 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data, 452 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // All allocation spaces other than NEW_SPACE have the same effect. 581 // All allocation spaces other than NEW_SPACE have the same effect.
582 Heap::CollectGarbage(0, OLD_DATA_SPACE); 582 Heap::CollectGarbage(0, OLD_DATA_SPACE);
583 return v8::Undefined(); 583 return v8::Undefined();
584 } 584 }
585 585
586 586
587 static GCExtension kGCExtension; 587 static GCExtension kGCExtension;
588 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); 588 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension);
589 589
590 } } // namespace v8::internal 590 } } // namespace v8::internal
OLDNEW
« src/apinatives.js ('K') | « src/apinatives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698