| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 v8::HandleScope scope(CcTest::isolate()); | 1171 v8::HandleScope scope(CcTest::isolate()); |
| 1172 | 1172 |
| 1173 Vector<const uint8_t> source_a = | 1173 Vector<const uint8_t> source_a = |
| 1174 ConstructSource(STATIC_CHAR_VECTOR("var a = \""), STATIC_CHAR_VECTOR("a"), | 1174 ConstructSource(STATIC_CHAR_VECTOR("var a = \""), STATIC_CHAR_VECTOR("a"), |
| 1175 STATIC_CHAR_VECTOR("\";"), 700000); | 1175 STATIC_CHAR_VECTOR("\";"), 700000); |
| 1176 Handle<String> source_a_str = | 1176 Handle<String> source_a_str = |
| 1177 f->NewStringFromOneByte(source_a).ToHandleChecked(); | 1177 f->NewStringFromOneByte(source_a).ToHandleChecked(); |
| 1178 | 1178 |
| 1179 Vector<const uint8_t> source_b = | 1179 Vector<const uint8_t> source_b = |
| 1180 ConstructSource(STATIC_CHAR_VECTOR("var b = \""), STATIC_CHAR_VECTOR("b"), | 1180 ConstructSource(STATIC_CHAR_VECTOR("var b = \""), STATIC_CHAR_VECTOR("b"), |
| 1181 STATIC_CHAR_VECTOR("\";"), 600000); | 1181 STATIC_CHAR_VECTOR("\";"), 400000); |
| 1182 Handle<String> source_b_str = | 1182 Handle<String> source_b_str = |
| 1183 f->NewStringFromOneByte(source_b).ToHandleChecked(); | 1183 f->NewStringFromOneByte(source_b).ToHandleChecked(); |
| 1184 | 1184 |
| 1185 Vector<const uint8_t> source_c = | 1185 Vector<const uint8_t> source_c = |
| 1186 ConstructSource(STATIC_CHAR_VECTOR("var c = \""), STATIC_CHAR_VECTOR("c"), | 1186 ConstructSource(STATIC_CHAR_VECTOR("var c = \""), STATIC_CHAR_VECTOR("c"), |
| 1187 STATIC_CHAR_VECTOR("\";"), 500000); | 1187 STATIC_CHAR_VECTOR("\";"), 400000); |
| 1188 Handle<String> source_c_str = | 1188 Handle<String> source_c_str = |
| 1189 f->NewStringFromOneByte(source_c).ToHandleChecked(); | 1189 f->NewStringFromOneByte(source_c).ToHandleChecked(); |
| 1190 | 1190 |
| 1191 Handle<String> source_str = | 1191 Handle<String> source_str = |
| 1192 f->NewConsString( | 1192 f->NewConsString( |
| 1193 f->NewConsString(source_a_str, source_b_str).ToHandleChecked(), | 1193 f->NewConsString(source_a_str, source_b_str).ToHandleChecked(), |
| 1194 source_c_str).ToHandleChecked(); | 1194 source_c_str).ToHandleChecked(); |
| 1195 | 1195 |
| 1196 Handle<JSObject> global(isolate->context()->global_object()); | 1196 Handle<JSObject> global(isolate->context()->global_object()); |
| 1197 ScriptData* cache = NULL; | 1197 ScriptData* cache = NULL; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1210 | 1210 |
| 1211 Handle<JSFunction> copy_fun = | 1211 Handle<JSFunction> copy_fun = |
| 1212 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1212 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 1213 copy, isolate->native_context()); | 1213 copy, isolate->native_context()); |
| 1214 | 1214 |
| 1215 USE(Execution::Call(isolate, copy_fun, global, 0, NULL)); | 1215 USE(Execution::Call(isolate, copy_fun, global, 0, NULL)); |
| 1216 | 1216 |
| 1217 v8::Maybe<int32_t> result = | 1217 v8::Maybe<int32_t> result = |
| 1218 CompileRun("(a + b).length") | 1218 CompileRun("(a + b).length") |
| 1219 ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); | 1219 ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); |
| 1220 CHECK_EQ(600000 + 700000, result.FromJust()); | 1220 CHECK_EQ(400000 + 700000, result.FromJust()); |
| 1221 result = CompileRun("(b + c).length") | 1221 result = CompileRun("(b + c).length") |
| 1222 ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); | 1222 ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); |
| 1223 CHECK_EQ(500000 + 600000, result.FromJust()); | 1223 CHECK_EQ(400000 + 400000, result.FromJust()); |
| 1224 Heap* heap = isolate->heap(); | 1224 Heap* heap = isolate->heap(); |
| 1225 v8::Local<v8::String> result_str = | 1225 v8::Local<v8::String> result_str = |
| 1226 CompileRun("a") | 1226 CompileRun("a") |
| 1227 ->ToString(CcTest::isolate()->GetCurrentContext()) | 1227 ->ToString(CcTest::isolate()->GetCurrentContext()) |
| 1228 .ToLocalChecked(); | 1228 .ToLocalChecked(); |
| 1229 CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE)); | 1229 CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE)); |
| 1230 result_str = CompileRun("b") | 1230 result_str = CompileRun("b") |
| 1231 ->ToString(CcTest::isolate()->GetCurrentContext()) | 1231 ->ToString(CcTest::isolate()->GetCurrentContext()) |
| 1232 .ToLocalChecked(); | 1232 .ToLocalChecked(); |
| 1233 CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE)); | 1233 CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE)); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 } | 2175 } |
| 2176 delete[] blob.data; | 2176 delete[] blob.data; |
| 2177 } | 2177 } |
| 2178 | 2178 |
| 2179 TEST(SerializationMemoryStats) { | 2179 TEST(SerializationMemoryStats) { |
| 2180 FLAG_profile_deserialization = true; | 2180 FLAG_profile_deserialization = true; |
| 2181 FLAG_always_opt = false; | 2181 FLAG_always_opt = false; |
| 2182 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 2182 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 2183 delete[] blob.data; | 2183 delete[] blob.data; |
| 2184 } | 2184 } |
| OLD | NEW |