OLD | NEW |
---|---|
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1047 Isolate* isolate = CcTest::i_isolate(); | 1047 Isolate* isolate = CcTest::i_isolate(); |
1048 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. | 1048 isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. |
1049 | 1049 |
1050 Factory* f = isolate->factory(); | 1050 Factory* f = isolate->factory(); |
1051 | 1051 |
1052 v8::HandleScope scope(CcTest::isolate()); | 1052 v8::HandleScope scope(CcTest::isolate()); |
1053 | 1053 |
1054 // Create a huge external internalized string to use as variable name. | 1054 // Create a huge external internalized string to use as variable name. |
1055 Vector<const uint8_t> string = | 1055 Vector<const uint8_t> string = |
1056 ConstructSource(STATIC_CHAR_VECTOR(""), STATIC_CHAR_VECTOR("abcdef"), | 1056 ConstructSource(STATIC_CHAR_VECTOR(""), STATIC_CHAR_VECTOR("abcdef"), |
1057 STATIC_CHAR_VECTOR(""), 1000000); | 1057 STATIC_CHAR_VECTOR(""), 999999); |
vogelheim
2014/10/23 16:48:44
What's the significance of this change? Is this me
Yang
2014/10/24 07:14:24
yes.
| |
1058 Handle<String> name = f->NewStringFromOneByte(string).ToHandleChecked(); | 1058 Handle<String> name = f->NewStringFromOneByte(string).ToHandleChecked(); |
1059 SerializerOneByteResource one_byte_resource( | 1059 SerializerOneByteResource one_byte_resource( |
1060 reinterpret_cast<const char*>(string.start()), string.length()); | 1060 reinterpret_cast<const char*>(string.start()), string.length()); |
1061 name = f->InternalizeString(name); | 1061 name = f->InternalizeString(name); |
1062 name->MakeExternal(&one_byte_resource); | 1062 name->MakeExternal(&one_byte_resource); |
1063 CHECK(name->IsExternalOneByteString()); | 1063 CHECK(name->IsExternalOneByteString()); |
1064 CHECK(name->IsInternalizedString()); | 1064 CHECK(name->IsInternalizedString()); |
1065 CHECK(isolate->heap()->InSpace(*name, LO_SPACE)); | 1065 CHECK(isolate->heap()->InSpace(*name, LO_SPACE)); |
1066 | 1066 |
1067 // Create the source, which is "var <literal> = 42; <literal>". | 1067 // Create the source, which is "var <literal> = 42; <literal>". |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1266 { | 1266 { |
1267 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1267 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
1268 script = v8::ScriptCompiler::CompileUnbound( | 1268 script = v8::ScriptCompiler::CompileUnbound( |
1269 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1269 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
1270 } | 1270 } |
1271 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1271 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
1272 CHECK(result->ToString()->Equals(v8_str("XY"))); | 1272 CHECK(result->ToString()->Equals(v8_str("XY"))); |
1273 } | 1273 } |
1274 isolate2->Dispose(); | 1274 isolate2->Dispose(); |
1275 } | 1275 } |
OLD | NEW |