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