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

Side by Side Diff: src/api.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/utils-a64.cc ('k') | src/arm/assembler-arm.cc » ('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 // 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 20 matching lines...) Expand all
31 #include <cmath> // For isnan. 31 #include <cmath> // For isnan.
32 #include "../include/v8-debug.h" 32 #include "../include/v8-debug.h"
33 #include "../include/v8-profiler.h" 33 #include "../include/v8-profiler.h"
34 #include "../include/v8-testing.h" 34 #include "../include/v8-testing.h"
35 #include "assert-scope.h" 35 #include "assert-scope.h"
36 #include "bootstrapper.h" 36 #include "bootstrapper.h"
37 #include "code-stubs.h" 37 #include "code-stubs.h"
38 #include "compiler.h" 38 #include "compiler.h"
39 #include "conversions-inl.h" 39 #include "conversions-inl.h"
40 #include "counters.h" 40 #include "counters.h"
41 #include "cpu-profiler.h"
41 #include "debug.h" 42 #include "debug.h"
42 #include "deoptimizer.h" 43 #include "deoptimizer.h"
43 #include "execution.h" 44 #include "execution.h"
44 #include "global-handles.h" 45 #include "global-handles.h"
45 #include "heap-profiler.h" 46 #include "heap-profiler.h"
46 #include "heap-snapshot-generator-inl.h" 47 #include "heap-snapshot-generator-inl.h"
47 #include "messages.h" 48 #include "messages.h"
48 #ifdef COMPRESS_STARTUP_DATA_BZ2 49 #ifdef COMPRESS_STARTUP_DATA_BZ2
49 #include "natives.h" 50 #include "natives.h"
50 #endif 51 #endif
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) { 292 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) {
292 return obj.IsEmpty() ? ReportEmptyHandle(location) : false; 293 return obj.IsEmpty() ? ReportEmptyHandle(location) : false;
293 } 294 }
294 295
295 296
296 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { 297 static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
297 return (obj == 0) ? ReportEmptyHandle(location) : false; 298 return (obj == 0) ? ReportEmptyHandle(location) : false;
298 } 299 }
299 300
301
300 // --- S t a t i c s --- 302 // --- S t a t i c s ---
301 303
302 304
303 static bool InitializeHelper() { 305 static bool InitializeHelper(i::Isolate* isolate) {
304 if (i::Snapshot::Initialize()) return true; 306 // If the isolate has a function entry hook, it needs to re-build all its
307 // code stubs with entry hooks embedded, so let's deserialize a snapshot.
308 if (isolate == NULL || isolate->function_entry_hook() == NULL) {
309 if (i::Snapshot::Initialize())
310 return true;
311 }
305 return i::V8::Initialize(NULL); 312 return i::V8::Initialize(NULL);
306 } 313 }
307 314
308 315
309 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate, 316 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
310 const char* location) { 317 const char* location) {
311 if (IsDeadCheck(isolate, location)) return false; 318 if (IsDeadCheck(isolate, location)) return false;
312 if (isolate != NULL) { 319 if (isolate != NULL) {
313 if (isolate->IsInitialized()) return true; 320 if (isolate->IsInitialized()) return true;
314 } 321 }
315 ASSERT(isolate == i::Isolate::Current()); 322 ASSERT(isolate == i::Isolate::Current());
316 return ApiCheck(InitializeHelper(), location, "Error initializing V8"); 323 return ApiCheck(InitializeHelper(isolate), location, "Error initializing V8");
317 } 324 }
318 325
326
319 // Some initializing API functions are called early and may be 327 // Some initializing API functions are called early and may be
320 // called on a thread different from static initializer thread. 328 // called on a thread different from static initializer thread.
321 // If Isolate API is used, Isolate::Enter() will initialize TLS so 329 // If Isolate API is used, Isolate::Enter() will initialize TLS so
322 // Isolate::Current() works. If it's a legacy case, then the thread 330 // Isolate::Current() works. If it's a legacy case, then the thread
323 // may not have TLS initialized yet. However, in initializing APIs it 331 // may not have TLS initialized yet. However, in initializing APIs it
324 // may be too early to call EnsureInitialized() - some pre-init 332 // may be too early to call EnsureInitialized() - some pre-init
325 // parameters still have to be configured. 333 // parameters still have to be configured.
326 static inline i::Isolate* EnterIsolateIfNeeded() { 334 static inline i::Isolate* EnterIsolateIfNeeded() {
327 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 335 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
328 if (isolate != NULL) 336 if (isolate != NULL)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return StartupData::kUncompressed; 390 return StartupData::kUncompressed;
383 #endif 391 #endif
384 } 392 }
385 393
386 394
387 enum CompressedStartupDataItems { 395 enum CompressedStartupDataItems {
388 kSnapshot = 0, 396 kSnapshot = 0,
389 kSnapshotContext, 397 kSnapshotContext,
390 kLibraries, 398 kLibraries,
391 kExperimentalLibraries, 399 kExperimentalLibraries,
400 #if defined(ENABLE_I18N_SUPPORT)
401 kI18NExtension,
402 #endif
392 kCompressedStartupDataCount 403 kCompressedStartupDataCount
393 }; 404 };
394 405
406
395 int V8::GetCompressedStartupDataCount() { 407 int V8::GetCompressedStartupDataCount() {
396 #ifdef COMPRESS_STARTUP_DATA_BZ2 408 #ifdef COMPRESS_STARTUP_DATA_BZ2
397 return kCompressedStartupDataCount; 409 return kCompressedStartupDataCount;
398 #else 410 #else
399 return 0; 411 return 0;
400 #endif 412 #endif
401 } 413 }
402 414
403 415
404 void V8::GetCompressedStartupData(StartupData* compressed_data) { 416 void V8::GetCompressedStartupData(StartupData* compressed_data) {
(...skipping 16 matching lines...) Expand all
421 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize(); 433 compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize();
422 434
423 i::Vector<const i::byte> exp_libraries_source = 435 i::Vector<const i::byte> exp_libraries_source =
424 i::ExperimentalNatives::GetScriptsSource(); 436 i::ExperimentalNatives::GetScriptsSource();
425 compressed_data[kExperimentalLibraries].data = 437 compressed_data[kExperimentalLibraries].data =
426 reinterpret_cast<const char*>(exp_libraries_source.start()); 438 reinterpret_cast<const char*>(exp_libraries_source.start());
427 compressed_data[kExperimentalLibraries].compressed_size = 439 compressed_data[kExperimentalLibraries].compressed_size =
428 exp_libraries_source.length(); 440 exp_libraries_source.length();
429 compressed_data[kExperimentalLibraries].raw_size = 441 compressed_data[kExperimentalLibraries].raw_size =
430 i::ExperimentalNatives::GetRawScriptsSize(); 442 i::ExperimentalNatives::GetRawScriptsSize();
443
444 #if defined(ENABLE_I18N_SUPPORT)
445 i::Vector<const ii:byte> i18n_extension_source =
446 i::I18NNatives::GetScriptsSource();
447 compressed_data[kI18NExtension].data =
448 reinterpret_cast<const char*>(i18n_extension_source.start());
449 compressed_data[kI18NExtension].compressed_size =
450 i18n_extension_source.length();
451 compressed_data[kI18NExtension].raw_size =
452 i::I18NNatives::GetRawScriptsSize();
453 #endif
431 #endif 454 #endif
432 } 455 }
433 456
434 457
435 void V8::SetDecompressedStartupData(StartupData* decompressed_data) { 458 void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
436 #ifdef COMPRESS_STARTUP_DATA_BZ2 459 #ifdef COMPRESS_STARTUP_DATA_BZ2
437 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size); 460 ASSERT_EQ(i::Snapshot::raw_size(), decompressed_data[kSnapshot].raw_size);
438 i::Snapshot::set_raw_data( 461 i::Snapshot::set_raw_data(
439 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data)); 462 reinterpret_cast<const i::byte*>(decompressed_data[kSnapshot].data));
440 463
441 ASSERT_EQ(i::Snapshot::context_raw_size(), 464 ASSERT_EQ(i::Snapshot::context_raw_size(),
442 decompressed_data[kSnapshotContext].raw_size); 465 decompressed_data[kSnapshotContext].raw_size);
443 i::Snapshot::set_context_raw_data( 466 i::Snapshot::set_context_raw_data(
444 reinterpret_cast<const i::byte*>( 467 reinterpret_cast<const i::byte*>(
445 decompressed_data[kSnapshotContext].data)); 468 decompressed_data[kSnapshotContext].data));
446 469
447 ASSERT_EQ(i::Natives::GetRawScriptsSize(), 470 ASSERT_EQ(i::Natives::GetRawScriptsSize(),
448 decompressed_data[kLibraries].raw_size); 471 decompressed_data[kLibraries].raw_size);
449 i::Vector<const char> libraries_source( 472 i::Vector<const char> libraries_source(
450 decompressed_data[kLibraries].data, 473 decompressed_data[kLibraries].data,
451 decompressed_data[kLibraries].raw_size); 474 decompressed_data[kLibraries].raw_size);
452 i::Natives::SetRawScriptsSource(libraries_source); 475 i::Natives::SetRawScriptsSource(libraries_source);
453 476
454 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), 477 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(),
455 decompressed_data[kExperimentalLibraries].raw_size); 478 decompressed_data[kExperimentalLibraries].raw_size);
456 i::Vector<const char> exp_libraries_source( 479 i::Vector<const char> exp_libraries_source(
457 decompressed_data[kExperimentalLibraries].data, 480 decompressed_data[kExperimentalLibraries].data,
458 decompressed_data[kExperimentalLibraries].raw_size); 481 decompressed_data[kExperimentalLibraries].raw_size);
459 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); 482 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source);
483
484 #if defined(ENABLE_I18N_SUPPORT)
485 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(),
486 decompressed_data[kI18NExtension].raw_size);
487 i::Vector<const char> i18n_extension_source(
488 decompressed_data[kI18NExtension].data,
489 decompressed_data[kI18NExtension].raw_size);
490 i::I18NNatives::SetRawScriptsSource(i18n_extension_source);
491 #endif
460 #endif 492 #endif
461 } 493 }
462 494
463 495
464 void V8::SetFatalErrorHandler(FatalErrorCallback that) { 496 void V8::SetFatalErrorHandler(FatalErrorCallback that) {
465 i::Isolate* isolate = EnterIsolateIfNeeded(); 497 i::Isolate* isolate = EnterIsolateIfNeeded();
466 isolate->set_exception_behavior(that); 498 isolate->set_exception_behavior(that);
467 } 499 }
468 500
469 501
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 666
635 void V8::ClearWeak(i::Object** obj) { 667 void V8::ClearWeak(i::Object** obj) {
636 i::GlobalHandles::ClearWeakness(obj); 668 i::GlobalHandles::ClearWeakness(obj);
637 } 669 }
638 670
639 671
640 void V8::DisposeGlobal(i::Object** obj) { 672 void V8::DisposeGlobal(i::Object** obj) {
641 i::GlobalHandles::Destroy(obj); 673 i::GlobalHandles::Destroy(obj);
642 } 674 }
643 675
676
644 // --- H a n d l e s --- 677 // --- H a n d l e s ---
645 678
646 679
647 HandleScope::HandleScope() { 680 HandleScope::HandleScope() {
648 Initialize(reinterpret_cast<Isolate*>(i::Isolate::Current())); 681 Initialize(reinterpret_cast<Isolate*>(i::Isolate::Current()));
649 } 682 }
650 683
651 684
652 HandleScope::HandleScope(Isolate* isolate) { 685 HandleScope::HandleScope(Isolate* isolate) {
653 Initialize(isolate); 686 Initialize(isolate);
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 } 2113 }
2081 } 2114 }
2082 2115
2083 2116
2084 // --- E x c e p t i o n s --- 2117 // --- E x c e p t i o n s ---
2085 2118
2086 2119
2087 v8::TryCatch::TryCatch() 2120 v8::TryCatch::TryCatch()
2088 : isolate_(i::Isolate::Current()), 2121 : isolate_(i::Isolate::Current()),
2089 next_(isolate_->try_catch_handler_address()), 2122 next_(isolate_->try_catch_handler_address()),
2090 exception_(isolate_->heap()->the_hole_value()),
2091 message_(i::Smi::FromInt(0)),
2092 is_verbose_(false), 2123 is_verbose_(false),
2093 can_continue_(true), 2124 can_continue_(true),
2094 capture_message_(true), 2125 capture_message_(true),
2095 rethrow_(false), 2126 rethrow_(false),
2096 has_terminated_(false) { 2127 has_terminated_(false) {
2128 Reset();
2097 isolate_->RegisterTryCatchHandler(this); 2129 isolate_->RegisterTryCatchHandler(this);
2098 } 2130 }
2099 2131
2100 2132
2101 v8::TryCatch::~TryCatch() { 2133 v8::TryCatch::~TryCatch() {
2102 ASSERT(isolate_ == i::Isolate::Current()); 2134 ASSERT(isolate_ == i::Isolate::Current());
2103 if (rethrow_) { 2135 if (rethrow_) {
2104 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); 2136 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_));
2105 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); 2137 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
2138 if (HasCaught() && capture_message_) {
2139 // If an exception was caught and rethrow_ is indicated, the saved
2140 // message, script, and location need to be restored to Isolate TLS
2141 // for reuse. capture_message_ needs to be disabled so that DoThrow()
2142 // does not create a new message.
2143 isolate_->thread_local_top()->rethrowing_message_ = true;
2144 isolate_->RestorePendingMessageFromTryCatch(this);
2145 }
2106 isolate_->UnregisterTryCatchHandler(this); 2146 isolate_->UnregisterTryCatchHandler(this);
2107 v8::ThrowException(exc); 2147 v8::ThrowException(exc);
2148 ASSERT(!isolate_->thread_local_top()->rethrowing_message_);
2108 } else { 2149 } else {
2109 isolate_->UnregisterTryCatchHandler(this); 2150 isolate_->UnregisterTryCatchHandler(this);
2110 } 2151 }
2111 } 2152 }
2112 2153
2113 2154
2114 bool v8::TryCatch::HasCaught() const { 2155 bool v8::TryCatch::HasCaught() const {
2115 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); 2156 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole();
2116 } 2157 }
2117 2158
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 if (value.is_null()) return v8::Local<Value>(); 2199 if (value.is_null()) return v8::Local<Value>();
2159 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); 2200 return v8::Utils::ToLocal(scope.CloseAndEscape(value));
2160 } else { 2201 } else {
2161 return v8::Local<Value>(); 2202 return v8::Local<Value>();
2162 } 2203 }
2163 } 2204 }
2164 2205
2165 2206
2166 v8::Local<v8::Message> v8::TryCatch::Message() const { 2207 v8::Local<v8::Message> v8::TryCatch::Message() const {
2167 ASSERT(isolate_ == i::Isolate::Current()); 2208 ASSERT(isolate_ == i::Isolate::Current());
2168 if (HasCaught() && message_ != i::Smi::FromInt(0)) { 2209 i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
2169 i::Object* message = reinterpret_cast<i::Object*>(message_); 2210 ASSERT(message->IsJSMessageObject() || message->IsTheHole());
2211 if (HasCaught() && !message->IsTheHole()) {
2170 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_)); 2212 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_));
2171 } else { 2213 } else {
2172 return v8::Local<v8::Message>(); 2214 return v8::Local<v8::Message>();
2173 } 2215 }
2174 } 2216 }
2175 2217
2176 2218
2177 void v8::TryCatch::Reset() { 2219 void v8::TryCatch::Reset() {
2178 ASSERT(isolate_ == i::Isolate::Current()); 2220 ASSERT(isolate_ == i::Isolate::Current());
2179 exception_ = isolate_->heap()->the_hole_value(); 2221 i::Object* the_hole = isolate_->heap()->the_hole_value();
2180 message_ = i::Smi::FromInt(0); 2222 exception_ = the_hole;
2223 message_obj_ = the_hole;
2224 message_script_ = the_hole;
2225 message_start_pos_ = 0;
2226 message_end_pos_ = 0;
2181 } 2227 }
2182 2228
2183 2229
2184 void v8::TryCatch::SetVerbose(bool value) { 2230 void v8::TryCatch::SetVerbose(bool value) {
2185 is_verbose_ = value; 2231 is_verbose_ = value;
2186 } 2232 }
2187 2233
2188 2234
2189 void v8::TryCatch::SetCaptureMessage(bool value) { 2235 void v8::TryCatch::SetCaptureMessage(bool value) {
2190 capture_message_ = value; 2236 capture_message_ = value;
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 LOG_API(isolate, "ToInteger"); 2955 LOG_API(isolate, "ToInteger");
2910 ENTER_V8(isolate); 2956 ENTER_V8(isolate);
2911 EXCEPTION_PREAMBLE(isolate); 2957 EXCEPTION_PREAMBLE(isolate);
2912 num = i::Execution::ToInteger(obj, &has_pending_exception); 2958 num = i::Execution::ToInteger(obj, &has_pending_exception);
2913 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); 2959 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>());
2914 } 2960 }
2915 return ToApiHandle<Integer>(num); 2961 return ToApiHandle<Integer>(num);
2916 } 2962 }
2917 2963
2918 2964
2919 #ifdef V8_ENABLE_CHECKS 2965 void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) {
2920 void i::Internals::CheckInitialized(v8::Isolate* external_isolate) {
2921 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); 2966 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
2922 ApiCheck(isolate != NULL && isolate->IsInitialized() && !i::V8::IsDead(), 2967 ApiCheck(isolate != NULL && isolate->IsInitialized() && !i::V8::IsDead(),
2923 "v8::internal::Internals::CheckInitialized()", 2968 "v8::internal::Internals::CheckInitialized()",
2924 "Isolate is not initialized or V8 has died"); 2969 "Isolate is not initialized or V8 has died");
2925 } 2970 }
2926 #endif
2927 2971
2928 2972
2929 void External::CheckCast(v8::Value* that) { 2973 void External::CheckCast(v8::Value* that) {
2930 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return; 2974 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return;
2931 ApiCheck(Utils::OpenHandle(that)->IsExternal(), 2975 ApiCheck(Utils::OpenHandle(that)->IsExternal(),
2932 "v8::External::Cast()", 2976 "v8::External::Cast()",
2933 "Could not convert to external"); 2977 "Could not convert to external");
2934 } 2978 }
2935 2979
2936 2980
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
3472 bool v8::Object::SetPrototype(Handle<Value> value) { 3516 bool v8::Object::SetPrototype(Handle<Value> value) {
3473 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3517 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3474 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); 3518 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
3475 ENTER_V8(isolate); 3519 ENTER_V8(isolate);
3476 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3520 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3477 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3521 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3478 // We do not allow exceptions thrown while setting the prototype 3522 // We do not allow exceptions thrown while setting the prototype
3479 // to propagate outside. 3523 // to propagate outside.
3480 TryCatch try_catch; 3524 TryCatch try_catch;
3481 EXCEPTION_PREAMBLE(isolate); 3525 EXCEPTION_PREAMBLE(isolate);
3482 i::Handle<i::Object> result = i::SetPrototype(self, value_obj); 3526 i::Handle<i::Object> result = i::JSObject::SetPrototype(self, value_obj);
3483 has_pending_exception = result.is_null(); 3527 has_pending_exception = result.is_null();
3484 EXCEPTION_BAILOUT_CHECK(isolate, false); 3528 EXCEPTION_BAILOUT_CHECK(isolate, false);
3485 return true; 3529 return true;
3486 } 3530 }
3487 3531
3488 3532
3489 Local<Object> v8::Object::FindInstanceInPrototypeChain( 3533 Local<Object> v8::Object::FindInstanceInPrototypeChain(
3490 v8::Handle<FunctionTemplate> tmpl) { 3534 v8::Handle<FunctionTemplate> tmpl) {
3491 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3535 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3492 ON_BAILOUT(isolate, 3536 ON_BAILOUT(isolate,
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 4419
4376 4420
4377 bool String::IsOneByte() const { 4421 bool String::IsOneByte() const {
4378 i::Handle<i::String> str = Utils::OpenHandle(this); 4422 i::Handle<i::String> str = Utils::OpenHandle(this);
4379 if (IsDeadCheck(str->GetIsolate(), "v8::String::IsOneByte()")) { 4423 if (IsDeadCheck(str->GetIsolate(), "v8::String::IsOneByte()")) {
4380 return false; 4424 return false;
4381 } 4425 }
4382 return str->HasOnlyOneByteChars(); 4426 return str->HasOnlyOneByteChars();
4383 } 4427 }
4384 4428
4429
4385 // Helpers for ContainsOnlyOneByteHelper 4430 // Helpers for ContainsOnlyOneByteHelper
4386 template<size_t size> struct OneByteMask; 4431 template<size_t size> struct OneByteMask;
4387 template<> struct OneByteMask<4> { 4432 template<> struct OneByteMask<4> {
4388 static const uint32_t value = 0xFF00FF00; 4433 static const uint32_t value = 0xFF00FF00;
4389 }; 4434 };
4390 template<> struct OneByteMask<8> { 4435 template<> struct OneByteMask<8> {
4391 static const uint64_t value = V8_2PART_UINT64_C(0xFF00FF00, FF00FF00); 4436 static const uint64_t value = V8_2PART_UINT64_C(0xFF00FF00, FF00FF00);
4392 }; 4437 };
4393 static const uintptr_t kOneByteMask = OneByteMask<sizeof(uintptr_t)>::value; 4438 static const uintptr_t kOneByteMask = OneByteMask<sizeof(uintptr_t)>::value;
4394 static const uintptr_t kAlignmentMask = sizeof(uintptr_t) - 1; 4439 static const uintptr_t kAlignmentMask = sizeof(uintptr_t) - 1;
4395 static inline bool Unaligned(const uint16_t* chars) { 4440 static inline bool Unaligned(const uint16_t* chars) {
4396 return reinterpret_cast<const uintptr_t>(chars) & kAlignmentMask; 4441 return reinterpret_cast<const uintptr_t>(chars) & kAlignmentMask;
4397 } 4442 }
4443
4444
4398 static inline const uint16_t* Align(const uint16_t* chars) { 4445 static inline const uint16_t* Align(const uint16_t* chars) {
4399 return reinterpret_cast<uint16_t*>( 4446 return reinterpret_cast<uint16_t*>(
4400 reinterpret_cast<uintptr_t>(chars) & ~kAlignmentMask); 4447 reinterpret_cast<uintptr_t>(chars) & ~kAlignmentMask);
4401 } 4448 }
4402 4449
4403 class ContainsOnlyOneByteHelper { 4450 class ContainsOnlyOneByteHelper {
4404 public: 4451 public:
4405 ContainsOnlyOneByteHelper() : is_one_byte_(true) {} 4452 ContainsOnlyOneByteHelper() : is_one_byte_(true) {}
4406 bool Check(i::String* string) { 4453 bool Check(i::String* string) {
4407 i::ConsString* cons_string = i::String::VisitFlat(this, string, 0); 4454 i::ConsString* cons_string = i::String::VisitFlat(this, string, 0);
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
5204 5251
5205 5252
5206 // --- E n v i r o n m e n t --- 5253 // --- E n v i r o n m e n t ---
5207 5254
5208 5255
5209 bool v8::V8::Initialize() { 5256 bool v8::V8::Initialize() {
5210 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5257 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5211 if (isolate != NULL && isolate->IsInitialized()) { 5258 if (isolate != NULL && isolate->IsInitialized()) {
5212 return true; 5259 return true;
5213 } 5260 }
5214 return InitializeHelper(); 5261 return InitializeHelper(isolate);
5215 } 5262 }
5216 5263
5217 5264
5218 void v8::V8::SetEntropySource(EntropySource source) { 5265 void v8::V8::SetEntropySource(EntropySource source) {
5219 i::V8::SetEntropySource(source); 5266 i::V8::SetEntropySource(source);
5220 } 5267 }
5221 5268
5222 5269
5223 void v8::V8::SetReturnAddressLocationResolver( 5270 void v8::V8::SetReturnAddressLocationResolver(
5224 ReturnAddressLocationResolver return_address_resolver) { 5271 ReturnAddressLocationResolver return_address_resolver) {
5225 i::V8::SetReturnAddressLocationResolver(return_address_resolver); 5272 i::V8::SetReturnAddressLocationResolver(return_address_resolver);
5226 } 5273 }
5227 5274
5228 5275
5229 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) { 5276 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) {
5230 return i::ProfileEntryHookStub::SetFunctionEntryHook(entry_hook); 5277 return SetFunctionEntryHook(Isolate::GetCurrent(), entry_hook);
5231 } 5278 }
5232 5279
5233 5280
5281 bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
5282 FunctionEntryHook entry_hook) {
5283 ASSERT(ext_isolate != NULL);
5284 ASSERT(entry_hook != NULL);
5285
5286 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
5287
5288 // The entry hook can only be set before the Isolate is initialized, as
5289 // otherwise the Isolate's code stubs generated at initialization won't
5290 // contain entry hooks.
5291 if (isolate->IsInitialized())
5292 return false;
5293
5294 // Setting an entry hook is a one-way operation, once set, it cannot be
5295 // changed or unset.
5296 if (isolate->function_entry_hook() != NULL)
5297 return false;
5298
5299 isolate->set_function_entry_hook(entry_hook);
5300 return true;
5301 }
5302
5303
5234 void v8::V8::SetJitCodeEventHandler( 5304 void v8::V8::SetJitCodeEventHandler(
5235 JitCodeEventOptions options, JitCodeEventHandler event_handler) { 5305 JitCodeEventOptions options, JitCodeEventHandler event_handler) {
5236 i::Isolate* isolate = i::Isolate::Current(); 5306 i::Isolate* isolate = i::Isolate::Current();
5237 // Ensure that logging is initialized for our isolate. 5307 // Ensure that logging is initialized for our isolate.
5238 isolate->InitializeLoggingAndCounters(); 5308 isolate->InitializeLoggingAndCounters();
5239 isolate->logger()->SetCodeEventHandler(options, event_handler); 5309 isolate->logger()->SetCodeEventHandler(options, event_handler);
5240 } 5310 }
5241 5311
5242 void v8::V8::SetArrayBufferAllocator( 5312 void v8::V8::SetArrayBufferAllocator(
5243 ArrayBuffer::Allocator* allocator) { 5313 ArrayBuffer::Allocator* allocator) {
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
6211 has_pending_exception = result.is_null(); 6281 has_pending_exception = result.is_null();
6212 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); 6282 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
6213 return Utils::ToLocal(result); 6283 return Utils::ToLocal(result);
6214 } 6284 }
6215 6285
6216 6286
6217 bool v8::ArrayBuffer::IsExternal() const { 6287 bool v8::ArrayBuffer::IsExternal() const {
6218 return Utils::OpenHandle(this)->is_external(); 6288 return Utils::OpenHandle(this)->is_external();
6219 } 6289 }
6220 6290
6291
6221 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { 6292 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
6222 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); 6293 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
6223 ApiCheck(!obj->is_external(), 6294 ApiCheck(!obj->is_external(),
6224 "v8::ArrayBuffer::Externalize", 6295 "v8::ArrayBuffer::Externalize",
6225 "ArrayBuffer already externalized"); 6296 "ArrayBuffer already externalized");
6226 obj->set_is_external(true); 6297 obj->set_is_external(true);
6227 size_t byte_length = static_cast<size_t>(obj->byte_length()->Number()); 6298 size_t byte_length = static_cast<size_t>(obj->byte_length()->Number());
6228 Contents contents; 6299 Contents contents;
6229 contents.data_ = obj->backing_store(); 6300 contents.data_ = obj->backing_store();
6230 contents.byte_length_ = byte_length; 6301 contents.byte_length_ = byte_length;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
6511 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 6582 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
6512 return Utils::IntegerToLocal(result); 6583 return Utils::IntegerToLocal(result);
6513 } 6584 }
6514 6585
6515 6586
6516 #ifdef DEBUG 6587 #ifdef DEBUG
6517 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) { 6588 v8::AssertNoGCScope::AssertNoGCScope(v8::Isolate* isolate) {
6518 disallow_heap_allocation_ = new i::DisallowHeapAllocation(); 6589 disallow_heap_allocation_ = new i::DisallowHeapAllocation();
6519 } 6590 }
6520 6591
6592
6521 v8::AssertNoGCScope::~AssertNoGCScope() { 6593 v8::AssertNoGCScope::~AssertNoGCScope() {
6522 delete static_cast<i::DisallowHeapAllocation*>(disallow_heap_allocation_); 6594 delete static_cast<i::DisallowHeapAllocation*>(disallow_heap_allocation_);
6523 } 6595 }
6524 #endif 6596 #endif
6525 6597
6526 6598
6527 void V8::IgnoreOutOfMemoryException() { 6599 void V8::IgnoreOutOfMemoryException() {
6528 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); 6600 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
6529 } 6601 }
6530 6602
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
6574 options); 6646 options);
6575 } 6647 }
6576 6648
6577 6649
6578 void V8::SetCounterFunction(CounterLookupCallback callback) { 6650 void V8::SetCounterFunction(CounterLookupCallback callback) {
6579 i::Isolate* isolate = EnterIsolateIfNeeded(); 6651 i::Isolate* isolate = EnterIsolateIfNeeded();
6580 if (IsDeadCheck(isolate, "v8::V8::SetCounterFunction()")) return; 6652 if (IsDeadCheck(isolate, "v8::V8::SetCounterFunction()")) return;
6581 isolate->stats_table()->SetCounterFunction(callback); 6653 isolate->stats_table()->SetCounterFunction(callback);
6582 } 6654 }
6583 6655
6656
6584 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { 6657 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
6585 i::Isolate* isolate = EnterIsolateIfNeeded(); 6658 i::Isolate* isolate = EnterIsolateIfNeeded();
6586 if (IsDeadCheck(isolate, "v8::V8::SetCreateHistogramFunction()")) return; 6659 if (IsDeadCheck(isolate, "v8::V8::SetCreateHistogramFunction()")) return;
6587 isolate->stats_table()->SetCreateHistogramFunction(callback); 6660 isolate->stats_table()->SetCreateHistogramFunction(callback);
6588 isolate->InitializeLoggingAndCounters(); 6661 isolate->InitializeLoggingAndCounters();
6589 isolate->counters()->ResetHistograms(); 6662 isolate->counters()->ResetHistograms();
6590 } 6663 }
6591 6664
6665
6592 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) { 6666 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
6593 i::Isolate* isolate = EnterIsolateIfNeeded(); 6667 i::Isolate* isolate = EnterIsolateIfNeeded();
6594 if (IsDeadCheck(isolate, "v8::V8::SetAddHistogramSampleFunction()")) return; 6668 if (IsDeadCheck(isolate, "v8::V8::SetAddHistogramSampleFunction()")) return;
6595 isolate->stats_table()-> 6669 isolate->stats_table()->
6596 SetAddHistogramSampleFunction(callback); 6670 SetAddHistogramSampleFunction(callback);
6597 } 6671 }
6598 6672
6599 void V8::SetFailedAccessCheckCallbackFunction( 6673 void V8::SetFailedAccessCheckCallbackFunction(
6600 FailedAccessCheckCallback callback) { 6674 FailedAccessCheckCallback callback) {
6601 i::Isolate* isolate = i::Isolate::Current(); 6675 i::Isolate* isolate = i::Isolate::Current();
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
6929 length_ = str->Length(); 7003 length_ = str->Length();
6930 str_ = i::NewArray<uint16_t>(length_ + 1); 7004 str_ = i::NewArray<uint16_t>(length_ + 1);
6931 str->Write(str_); 7005 str->Write(str_);
6932 } 7006 }
6933 7007
6934 7008
6935 String::Value::~Value() { 7009 String::Value::~Value() {
6936 i::DeleteArray(str_); 7010 i::DeleteArray(str_);
6937 } 7011 }
6938 7012
7013
6939 Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) { 7014 Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
6940 i::Isolate* isolate = i::Isolate::Current(); 7015 i::Isolate* isolate = i::Isolate::Current();
6941 LOG_API(isolate, "RangeError"); 7016 LOG_API(isolate, "RangeError");
6942 ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>()); 7017 ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>());
6943 ENTER_V8(isolate); 7018 ENTER_V8(isolate);
6944 i::Object* error; 7019 i::Object* error;
6945 { 7020 {
6946 i::HandleScope scope(isolate); 7021 i::HandleScope scope(isolate);
6947 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 7022 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
6948 i::Handle<i::Object> result = isolate->factory()->NewRangeError(message); 7023 i::Handle<i::Object> result = isolate->factory()->NewRangeError(message);
6949 error = *result; 7024 error = *result;
6950 } 7025 }
6951 i::Handle<i::Object> result(error, isolate); 7026 i::Handle<i::Object> result(error, isolate);
6952 return Utils::ToLocal(result); 7027 return Utils::ToLocal(result);
6953 } 7028 }
6954 7029
7030
6955 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) { 7031 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
6956 i::Isolate* isolate = i::Isolate::Current(); 7032 i::Isolate* isolate = i::Isolate::Current();
6957 LOG_API(isolate, "ReferenceError"); 7033 LOG_API(isolate, "ReferenceError");
6958 ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>()); 7034 ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>());
6959 ENTER_V8(isolate); 7035 ENTER_V8(isolate);
6960 i::Object* error; 7036 i::Object* error;
6961 { 7037 {
6962 i::HandleScope scope(isolate); 7038 i::HandleScope scope(isolate);
6963 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 7039 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
6964 i::Handle<i::Object> result = 7040 i::Handle<i::Object> result =
6965 isolate->factory()->NewReferenceError(message); 7041 isolate->factory()->NewReferenceError(message);
6966 error = *result; 7042 error = *result;
6967 } 7043 }
6968 i::Handle<i::Object> result(error, isolate); 7044 i::Handle<i::Object> result(error, isolate);
6969 return Utils::ToLocal(result); 7045 return Utils::ToLocal(result);
6970 } 7046 }
6971 7047
7048
6972 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) { 7049 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
6973 i::Isolate* isolate = i::Isolate::Current(); 7050 i::Isolate* isolate = i::Isolate::Current();
6974 LOG_API(isolate, "SyntaxError"); 7051 LOG_API(isolate, "SyntaxError");
6975 ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>()); 7052 ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>());
6976 ENTER_V8(isolate); 7053 ENTER_V8(isolate);
6977 i::Object* error; 7054 i::Object* error;
6978 { 7055 {
6979 i::HandleScope scope(isolate); 7056 i::HandleScope scope(isolate);
6980 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 7057 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
6981 i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(message); 7058 i::Handle<i::Object> result = isolate->factory()->NewSyntaxError(message);
6982 error = *result; 7059 error = *result;
6983 } 7060 }
6984 i::Handle<i::Object> result(error, isolate); 7061 i::Handle<i::Object> result(error, isolate);
6985 return Utils::ToLocal(result); 7062 return Utils::ToLocal(result);
6986 } 7063 }
6987 7064
7065
6988 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) { 7066 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
6989 i::Isolate* isolate = i::Isolate::Current(); 7067 i::Isolate* isolate = i::Isolate::Current();
6990 LOG_API(isolate, "TypeError"); 7068 LOG_API(isolate, "TypeError");
6991 ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>()); 7069 ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>());
6992 ENTER_V8(isolate); 7070 ENTER_V8(isolate);
6993 i::Object* error; 7071 i::Object* error;
6994 { 7072 {
6995 i::HandleScope scope(isolate); 7073 i::HandleScope scope(isolate);
6996 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 7074 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
6997 i::Handle<i::Object> result = isolate->factory()->NewTypeError(message); 7075 i::Handle<i::Object> result = isolate->factory()->NewTypeError(message);
6998 error = *result; 7076 error = *result;
6999 } 7077 }
7000 i::Handle<i::Object> result(error, isolate); 7078 i::Handle<i::Object> result(error, isolate);
7001 return Utils::ToLocal(result); 7079 return Utils::ToLocal(result);
7002 } 7080 }
7003 7081
7082
7004 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) { 7083 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
7005 i::Isolate* isolate = i::Isolate::Current(); 7084 i::Isolate* isolate = i::Isolate::Current();
7006 LOG_API(isolate, "Error"); 7085 LOG_API(isolate, "Error");
7007 ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>()); 7086 ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>());
7008 ENTER_V8(isolate); 7087 ENTER_V8(isolate);
7009 i::Object* error; 7088 i::Object* error;
7010 { 7089 {
7011 i::HandleScope scope(isolate); 7090 i::HandleScope scope(isolate);
7012 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 7091 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
7013 i::Handle<i::Object> result = isolate->factory()->NewError(message); 7092 i::Handle<i::Object> result = isolate->factory()->NewError(message);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
7280 return ToApiHandle<String>( 7359 return ToApiHandle<String>(
7281 isolate->factory()->InternalizeUtf8String(entry->name())); 7360 isolate->factory()->InternalizeUtf8String(entry->name()));
7282 } else { 7361 } else {
7283 return ToApiHandle<String>(isolate->factory()->NewConsString( 7362 return ToApiHandle<String>(isolate->factory()->NewConsString(
7284 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 7363 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
7285 isolate->factory()->InternalizeUtf8String(entry->name()))); 7364 isolate->factory()->InternalizeUtf8String(entry->name())));
7286 } 7365 }
7287 } 7366 }
7288 7367
7289 7368
7369 int CpuProfileNode::GetScriptId() const {
7370 i::Isolate* isolate = i::Isolate::Current();
7371 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptId");
7372 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7373 const i::CodeEntry* entry = node->entry();
7374 return entry->script_id();
7375 }
7376
7377
7290 Handle<String> CpuProfileNode::GetScriptResourceName() const { 7378 Handle<String> CpuProfileNode::GetScriptResourceName() const {
7291 i::Isolate* isolate = i::Isolate::Current(); 7379 i::Isolate* isolate = i::Isolate::Current();
7292 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); 7380 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
7293 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7381 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7294 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( 7382 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String(
7295 node->entry()->resource_name())); 7383 node->entry()->resource_name()));
7296 } 7384 }
7297 7385
7298 7386
7299 int CpuProfileNode::GetLineNumber() const { 7387 int CpuProfileNode::GetLineNumber() const {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
7358 return reinterpret_cast<const CpuProfileNode*>(child); 7446 return reinterpret_cast<const CpuProfileNode*>(child);
7359 } 7447 }
7360 7448
7361 7449
7362 void CpuProfile::Delete() { 7450 void CpuProfile::Delete() {
7363 i::Isolate* isolate = i::Isolate::Current(); 7451 i::Isolate* isolate = i::Isolate::Current();
7364 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); 7452 IsDeadCheck(isolate, "v8::CpuProfile::Delete");
7365 i::CpuProfiler* profiler = isolate->cpu_profiler(); 7453 i::CpuProfiler* profiler = isolate->cpu_profiler();
7366 ASSERT(profiler != NULL); 7454 ASSERT(profiler != NULL);
7367 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); 7455 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
7368 if (profiler->GetProfilesCount() == 0 && !profiler->HasDetachedProfiles()) { 7456 if (profiler->GetProfilesCount() == 0) {
7369 // If this was the last profile, clean up all accessory data as well. 7457 // If this was the last profile, clean up all accessory data as well.
7370 profiler->DeleteAllProfiles(); 7458 profiler->DeleteAllProfiles();
7371 } 7459 }
7372 } 7460 }
7373 7461
7374 7462
7375 unsigned CpuProfile::GetUid() const { 7463 unsigned CpuProfile::GetUid() const {
7376 i::Isolate* isolate = i::Isolate::Current(); 7464 i::Isolate* isolate = i::Isolate::Current();
7377 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); 7465 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
7378 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 7466 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
(...skipping 26 matching lines...) Expand all
7405 int CpuProfile::GetSamplesCount() const { 7493 int CpuProfile::GetSamplesCount() const {
7406 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); 7494 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count();
7407 } 7495 }
7408 7496
7409 7497
7410 int CpuProfiler::GetProfileCount() { 7498 int CpuProfiler::GetProfileCount() {
7411 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount(); 7499 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount();
7412 } 7500 }
7413 7501
7414 7502
7415 const CpuProfile* CpuProfiler::GetCpuProfile(int index,
7416 Handle<Value> security_token) {
7417 return reinterpret_cast<const CpuProfile*>(
7418 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(
7419 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
7420 index));
7421 }
7422
7423
7424 const CpuProfile* CpuProfiler::GetCpuProfile(int index) { 7503 const CpuProfile* CpuProfiler::GetCpuProfile(int index) {
7425 return reinterpret_cast<const CpuProfile*>( 7504 return reinterpret_cast<const CpuProfile*>(
7426 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(NULL, index)); 7505 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(index));
7427 } 7506 }
7428 7507
7429 7508
7430 const CpuProfile* CpuProfiler::FindCpuProfile(unsigned uid,
7431 Handle<Value> security_token) {
7432 return reinterpret_cast<const CpuProfile*>(
7433 reinterpret_cast<i::CpuProfiler*>(this)->FindProfile(
7434 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
7435 uid));
7436 }
7437
7438
7439 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { 7509 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) {
7440 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( 7510 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
7441 *Utils::OpenHandle(*title), record_samples); 7511 *Utils::OpenHandle(*title), record_samples);
7442 } 7512 }
7443 7513
7444 7514
7445 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title,
7446 Handle<Value> security_token) {
7447 return reinterpret_cast<const CpuProfile*>(
7448 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
7449 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
7450 *Utils::OpenHandle(*title)));
7451 }
7452
7453
7454 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { 7515 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) {
7455 return reinterpret_cast<const CpuProfile*>( 7516 return reinterpret_cast<const CpuProfile*>(
7456 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( 7517 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
7457 NULL,
7458 *Utils::OpenHandle(*title))); 7518 *Utils::OpenHandle(*title)));
7459 } 7519 }
7460 7520
7461 7521
7462 void CpuProfiler::DeleteAllCpuProfiles() { 7522 void CpuProfiler::DeleteAllCpuProfiles() {
7463 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles(); 7523 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles();
7464 } 7524 }
7465 7525
7466 7526
7467 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 7527 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
7666 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount(); 7726 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount();
7667 } 7727 }
7668 7728
7669 7729
7670 const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) { 7730 const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) {
7671 return reinterpret_cast<const HeapSnapshot*>( 7731 return reinterpret_cast<const HeapSnapshot*>(
7672 reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index)); 7732 reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index));
7673 } 7733 }
7674 7734
7675 7735
7676 const HeapSnapshot* HeapProfiler::FindHeapSnapshot(unsigned uid) {
7677 return reinterpret_cast<const HeapSnapshot*>(
7678 reinterpret_cast<i::HeapProfiler*>(this)->FindSnapshot(uid));
7679 }
7680
7681
7682 SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) { 7736 SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) {
7683 i::Handle<i::Object> obj = Utils::OpenHandle(*value); 7737 i::Handle<i::Object> obj = Utils::OpenHandle(*value);
7684 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj); 7738 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj);
7685 } 7739 }
7686 7740
7687 7741
7688 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( 7742 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
7689 Handle<String> title, 7743 Handle<String> title,
7690 ActivityControl* control, 7744 ActivityControl* control,
7691 ObjectNameResolver* resolver) { 7745 ObjectNameResolver* resolver) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
7735 7789
7736 7790
7737 v8::Testing::StressType internal::Testing::stress_type_ = 7791 v8::Testing::StressType internal::Testing::stress_type_ =
7738 v8::Testing::kStressTypeOpt; 7792 v8::Testing::kStressTypeOpt;
7739 7793
7740 7794
7741 void Testing::SetStressRunType(Testing::StressType type) { 7795 void Testing::SetStressRunType(Testing::StressType type) {
7742 internal::Testing::set_stress_type(type); 7796 internal::Testing::set_stress_type(type);
7743 } 7797 }
7744 7798
7799
7745 int Testing::GetStressRuns() { 7800 int Testing::GetStressRuns() {
7746 if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs; 7801 if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs;
7747 #ifdef DEBUG 7802 #ifdef DEBUG
7748 // In debug mode the code runs much slower so stressing will only make two 7803 // In debug mode the code runs much slower so stressing will only make two
7749 // runs. 7804 // runs.
7750 return 2; 7805 return 2;
7751 #else 7806 #else
7752 return 5; 7807 return 5;
7753 #endif 7808 #endif
7754 } 7809 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
7991 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8046 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7992 Address callback_address = 8047 Address callback_address =
7993 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8048 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7994 VMState<EXTERNAL> state(isolate); 8049 VMState<EXTERNAL> state(isolate);
7995 ExternalCallbackScope call_scope(isolate, callback_address); 8050 ExternalCallbackScope call_scope(isolate, callback_address);
7996 return callback(info); 8051 return callback(info);
7997 } 8052 }
7998 8053
7999 8054
8000 } } // namespace v8::internal 8055 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/utils-a64.cc ('k') | src/arm/assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698