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