OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |