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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 Handle<String> source, | 863 Handle<String> source, |
864 SourceCodeCache* cache, | 864 SourceCodeCache* cache, |
865 v8::Extension* extension, | 865 v8::Extension* extension, |
866 bool use_runtime_context) { | 866 bool use_runtime_context) { |
867 HandleScope scope; | 867 HandleScope scope; |
868 Handle<JSFunction> boilerplate; | 868 Handle<JSFunction> boilerplate; |
869 | 869 |
870 // If we can't find the function in the cache, we compile a new | 870 // If we can't find the function in the cache, we compile a new |
871 // function and insert it into the cache. | 871 // function and insert it into the cache. |
872 if (!cache->Lookup(name, &boilerplate)) { | 872 if (!cache->Lookup(name, &boilerplate)) { |
873 #ifdef DEBUG | 873 ASSERT(source->IsAsciiRepresentation()); |
874 ASSERT(StringShape(*source).IsAsciiRepresentation()); | |
875 #endif | |
876 Handle<String> script_name = Factory::NewStringFromUtf8(name); | 874 Handle<String> script_name = Factory::NewStringFromUtf8(name); |
877 boilerplate = | 875 boilerplate = |
878 Compiler::Compile(source, script_name, 0, 0, extension, NULL); | 876 Compiler::Compile(source, script_name, 0, 0, extension, NULL); |
879 if (boilerplate.is_null()) return false; | 877 if (boilerplate.is_null()) return false; |
880 cache->Add(name, boilerplate); | 878 cache->Add(name, boilerplate); |
881 } | 879 } |
882 | 880 |
883 // Setup the function context. Conceptually, we should clone the | 881 // Setup the function context. Conceptually, we should clone the |
884 // function before overwriting the context but since we're in a | 882 // function before overwriting the context but since we're in a |
885 // single-threaded environment it is not strictly necessary. | 883 // single-threaded environment it is not strictly necessary. |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 } | 1547 } |
1550 | 1548 |
1551 | 1549 |
1552 // Restore statics that are thread local. | 1550 // Restore statics that are thread local. |
1553 char* Genesis::RestoreState(char* from) { | 1551 char* Genesis::RestoreState(char* from) { |
1554 current_ = *reinterpret_cast<Genesis**>(from); | 1552 current_ = *reinterpret_cast<Genesis**>(from); |
1555 return from + sizeof(current_); | 1553 return from + sizeof(current_); |
1556 } | 1554 } |
1557 | 1555 |
1558 } } // namespace v8::internal | 1556 } } // namespace v8::internal |
OLD | NEW |