Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Side by Side Diff: src/api.cc

Issue 882443004: Revert of Only use FreeSpace objects in the free list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
11 #include <cmath> // For isnan. 11 #include <cmath> // For isnan.
12 #include "include/v8-debug.h" 12 #include "include/v8-debug.h"
13 #include "include/v8-profiler.h" 13 #include "include/v8-profiler.h"
14 #include "include/v8-testing.h" 14 #include "include/v8-testing.h"
15 #include "src/assert-scope.h" 15 #include "src/assert-scope.h"
16 #include "src/background-parsing-task.h" 16 #include "src/background-parsing-task.h"
17 #include "src/base/functional.h" 17 #include "src/base/functional.h"
18 #include "src/base/platform/platform.h" 18 #include "src/base/platform/platform.h"
19 #include "src/base/platform/time.h" 19 #include "src/base/platform/time.h"
20 #include "src/base/utils/random-number-generator.h" 20 #include "src/base/utils/random-number-generator.h"
21 #include "src/bootstrapper.h" 21 #include "src/bootstrapper.h"
22 #include "src/code-stubs.h" 22 #include "src/code-stubs.h"
23 #include "src/compiler.h" 23 #include "src/compiler.h"
24 #include "src/conversions-inl.h" 24 #include "src/conversions-inl.h"
25 #include "src/counters.h" 25 #include "src/counters.h"
26 #include "src/cpu-profiler.h" 26 #include "src/cpu-profiler.h"
27 #include "src/debug.h" 27 #include "src/debug.h"
28 #include "src/deoptimizer.h" 28 #include "src/deoptimizer.h"
29 #include "src/execution.h" 29 #include "src/execution.h"
30 #include "src/full-codegen.h"
31 #include "src/global-handles.h" 30 #include "src/global-handles.h"
32 #include "src/heap-profiler.h" 31 #include "src/heap-profiler.h"
33 #include "src/heap-snapshot-generator-inl.h" 32 #include "src/heap-snapshot-generator-inl.h"
34 #include "src/icu_util.h" 33 #include "src/icu_util.h"
35 #include "src/json-parser.h" 34 #include "src/json-parser.h"
36 #include "src/messages.h" 35 #include "src/messages.h"
37 #include "src/natives.h" 36 #include "src/natives.h"
38 #include "src/parser.h" 37 #include "src/parser.h"
39 #include "src/profile-generator-inl.h" 38 #include "src/profile-generator-inl.h"
40 #include "src/property.h" 39 #include "src/property.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (try_catch.HasCaught()) return false; 213 if (try_catch.HasCaught()) return false;
215 ScriptOrigin origin(String::NewFromUtf8(isolate, "<embedded script>")); 214 ScriptOrigin origin(String::NewFromUtf8(isolate, "<embedded script>"));
216 ScriptCompiler::Source source(source_string, origin); 215 ScriptCompiler::Source source(source_string, origin);
217 Local<Script> script = ScriptCompiler::Compile(isolate, &source); 216 Local<Script> script = ScriptCompiler::Compile(isolate, &source);
218 if (try_catch.HasCaught()) return false; 217 if (try_catch.HasCaught()) return false;
219 script->Run(); 218 script->Run();
220 return !try_catch.HasCaught(); 219 return !try_catch.HasCaught();
221 } 220 }
222 221
223 222
224 void CheckDefaultReservationSizes(const i::StartupSerializer& startup_ser,
225 const i::PartialSerializer& context_ser) {
226 #ifdef DEBUG
227 i::List<i::SerializedData::Reservation> startup_reservations;
228 i::List<i::SerializedData::Reservation> context_reservations;
229 startup_ser.EncodeReservations(&startup_reservations);
230 context_ser.EncodeReservations(&context_reservations);
231 for (int space = 0; space < i::Serializer::kNumberOfSpaces; space++) {
232 // Exactly one chunk per space.
233 CHECK(startup_reservations[space].is_last());
234 CHECK(startup_reservations[space].is_last());
235 uint32_t sum = startup_reservations[space].chunk_size() +
236 context_reservations[space].chunk_size();
237 uint32_t limit = 0;
238 const int constant_pool_delta = i::FLAG_enable_ool_constant_pool ? 48 : 0;
239 switch (space) {
240 case i::NEW_SPACE:
241 limit = 3 * i::kPointerSize;
242 break;
243 case i::OLD_POINTER_SPACE:
244 limit = (128 + constant_pool_delta) * i::kPointerSize * i::KB;
245 break;
246 case i::OLD_DATA_SPACE:
247 limit = 192 * i::KB;
248 break;
249 case i::MAP_SPACE:
250 limit = 16 * i::kPointerSize * i::KB;
251 break;
252 case i::CELL_SPACE:
253 limit = 16 * i::kPointerSize * i::KB;
254 break;
255 case i::PROPERTY_CELL_SPACE:
256 limit = 8 * i::kPointerSize * i::KB;
257 break;
258 case i::CODE_SPACE:
259 limit = RoundUp((480 - constant_pool_delta) * i::KB *
260 i::FullCodeGenerator::kBootCodeSizeMultiplier / 100,
261 i::kPointerSize);
262 break;
263 default:
264 break;
265 }
266 CHECK_LE(sum, limit);
267 }
268 #endif // DEBUG
269 }
270
271
272 StartupData V8::CreateSnapshotDataBlob(char* custom_source) { 223 StartupData V8::CreateSnapshotDataBlob(char* custom_source) {
273 Isolate::CreateParams params; 224 Isolate::CreateParams params;
274 params.enable_serializer = true; 225 params.enable_serializer = true;
275 Isolate* isolate = v8::Isolate::New(params); 226 Isolate* isolate = v8::Isolate::New(params);
276 StartupData result = {NULL, 0}; 227 StartupData result = {NULL, 0};
277 { 228 {
278 Isolate::Scope isolate_scope(isolate); 229 Isolate::Scope isolate_scope(isolate);
279 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 230 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
280 Persistent<Context> context; 231 Persistent<Context> context;
281 i::Snapshot::Metadata metadata; 232 i::Snapshot::Metadata metadata;
(...skipping 26 matching lines...) Expand all
308 ser.SerializeStrongReferences(); 259 ser.SerializeStrongReferences();
309 260
310 i::SnapshotByteSink context_sink; 261 i::SnapshotByteSink context_sink;
311 i::PartialSerializer context_ser(internal_isolate, &ser, &context_sink); 262 i::PartialSerializer context_ser(internal_isolate, &ser, &context_sink);
312 context_ser.Serialize(&raw_context); 263 context_ser.Serialize(&raw_context);
313 ser.SerializeWeakReferences(); 264 ser.SerializeWeakReferences();
314 265
315 i::SnapshotData sd(snapshot_sink, ser); 266 i::SnapshotData sd(snapshot_sink, ser);
316 i::SnapshotData csd(context_sink, context_ser); 267 i::SnapshotData csd(context_sink, context_ser);
317 268
318 if (custom_source == NULL) CheckDefaultReservationSizes(ser, context_ser);
319
320 result = i::Snapshot::CreateSnapshotBlob(sd.RawData(), csd.RawData(), 269 result = i::Snapshot::CreateSnapshotBlob(sd.RawData(), csd.RawData(),
321 metadata); 270 metadata);
322 } 271 }
323 } 272 }
324 isolate->Dispose(); 273 isolate->Dispose();
325 return result; 274 return result;
326 } 275 }
327 276
328 277
329 void V8::SetFlagsFromString(const char* str, int length) { 278 void V8::SetFlagsFromString(const char* str, int length) {
(...skipping 7326 matching lines...) Expand 10 before | Expand all | Expand 10 after
7656 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7605 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7657 Address callback_address = 7606 Address callback_address =
7658 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7607 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7659 VMState<EXTERNAL> state(isolate); 7608 VMState<EXTERNAL> state(isolate);
7660 ExternalCallbackScope call_scope(isolate, callback_address); 7609 ExternalCallbackScope call_scope(isolate, callback_address);
7661 callback(info); 7610 callback(info);
7662 } 7611 }
7663 7612
7664 7613
7665 } } // namespace v8::internal 7614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698