| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 SourceCodeCache* cache, | 833 SourceCodeCache* cache, |
| 834 v8::Extension* extension, | 834 v8::Extension* extension, |
| 835 bool use_runtime_context) { | 835 bool use_runtime_context) { |
| 836 HandleScope scope; | 836 HandleScope scope; |
| 837 Handle<JSFunction> boilerplate; | 837 Handle<JSFunction> boilerplate; |
| 838 | 838 |
| 839 // If we can't find the function in the cache, we compile a new | 839 // If we can't find the function in the cache, we compile a new |
| 840 // function and insert it into the cache. | 840 // function and insert it into the cache. |
| 841 if (!cache->Lookup(name, &boilerplate)) { | 841 if (!cache->Lookup(name, &boilerplate)) { |
| 842 #ifdef DEBUG | 842 #ifdef DEBUG |
| 843 ASSERT(source->IsAsciiRepresentation()); | 843 ASSERT(StringShape(*source).IsAsciiRepresentation()); |
| 844 #endif | 844 #endif |
| 845 Handle<String> script_name = Factory::NewStringFromUtf8(name); | 845 Handle<String> script_name = Factory::NewStringFromUtf8(name); |
| 846 boilerplate = | 846 boilerplate = |
| 847 Compiler::Compile(source, script_name, 0, 0, extension, NULL); | 847 Compiler::Compile(source, script_name, 0, 0, extension, NULL); |
| 848 if (boilerplate.is_null()) return false; | 848 if (boilerplate.is_null()) return false; |
| 849 cache->Add(name, boilerplate); | 849 cache->Add(name, boilerplate); |
| 850 } | 850 } |
| 851 | 851 |
| 852 // Setup the function context. Conceptually, we should clone the | 852 // Setup the function context. Conceptually, we should clone the |
| 853 // function before overwriting the context but since we're in a | 853 // function before overwriting the context but since we're in a |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 if (!ConfigureGlobalObjects(global_template)) return; | 1448 if (!ConfigureGlobalObjects(global_template)) return; |
| 1449 | 1449 |
| 1450 if (!InstallExtensions(extensions)) return; | 1450 if (!InstallExtensions(extensions)) return; |
| 1451 | 1451 |
| 1452 if (!InstallSpecialObjects()) return; | 1452 if (!InstallSpecialObjects()) return; |
| 1453 | 1453 |
| 1454 result_ = global_context_; | 1454 result_ = global_context_; |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 } } // namespace v8::internal | 1457 } } // namespace v8::internal |
| OLD | NEW |