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

Side by Side Diff: src/api.cc

Issue 6696042: Adding 'isolates' argument to LOG to get rid of multiple TLS fetches in profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Addressing code review feedback + rebase Created 9 years, 9 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 | « no previous file | src/builtins.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "runtime-profiler.h" 44 #include "runtime-profiler.h"
45 #include "serialize.h" 45 #include "serialize.h"
46 #include "snapshot.h" 46 #include "snapshot.h"
47 #include "v8threads.h" 47 #include "v8threads.h"
48 #include "version.h" 48 #include "version.h"
49 #include "vm-state-inl.h" 49 #include "vm-state-inl.h"
50 50
51 #include "../include/v8-profiler.h" 51 #include "../include/v8-profiler.h"
52 #include "../include/v8-testing.h" 52 #include "../include/v8-testing.h"
53 53
54 #define LOG_API(expr) LOG(ApiEntryCall(expr)) 54 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
55 55
56 // TODO(isolates): avoid repeated TLS reads in function prologues. 56 // TODO(isolates): avoid repeated TLS reads in function prologues.
57 #ifdef ENABLE_VMSTATE_TRACKING 57 #ifdef ENABLE_VMSTATE_TRACKING
58 #define ENTER_V8 \ 58 #define ENTER_V8 \
59 ASSERT(i::Isolate::Current()->IsInitialized()); \ 59 ASSERT(i::Isolate::Current()->IsInitialized()); \
60 i::VMState __state__(i::Isolate::Current(), i::OTHER) 60 i::VMState __state__(i::Isolate::Current(), i::OTHER)
61 #define LEAVE_V8 \ 61 #define LEAVE_V8 \
62 i::VMState __state__(i::Isolate::Current(), i::EXTERNAL) 62 i::VMState __state__(i::Isolate::Current(), i::EXTERNAL)
63 #else 63 #else
64 #define ENTER_V8 ((void) 0) 64 #define ENTER_V8 ((void) 0)
65 #define LEAVE_V8 ((void) 0) 65 #define LEAVE_V8 ((void) 0)
66 #endif 66 #endif
67 67
68 namespace v8 { 68 namespace v8 {
69 69
70 #define ON_BAILOUT(location, code) \ 70 #define ON_BAILOUT(isolate, location, code) \
71 if (IsDeadCheck(location) || v8::V8::IsExecutionTerminating()) { \ 71 if (IsDeadCheck(isolate, location) || \
72 v8::V8::IsExecutionTerminating()) { \
72 code; \ 73 code; \
73 UNREACHABLE(); \ 74 UNREACHABLE(); \
74 } 75 }
75 76
76 77
77 #define EXCEPTION_PREAMBLE() \ 78 #define EXCEPTION_PREAMBLE() \
78 i::Isolate* isolate = i::Isolate::Current(); \ 79 i::Isolate::Current()->handle_scope_implementer()->IncrementCallDepth(); \
79 isolate->handle_scope_implementer()->IncrementCallDepth(); \ 80 ASSERT(!i::Isolate::Current()->external_caught_exception()); \
80 ASSERT(!isolate->external_caught_exception()); \
81 bool has_pending_exception = false 81 bool has_pending_exception = false
82 82
83 83
84 #define EXCEPTION_BAILOUT_CHECK(value) \ 84 #define EXCEPTION_BAILOUT_CHECK(value) \
85 do { \ 85 do { \
86 i::HandleScopeImplementer* handle_scope_implementer = \ 86 i::HandleScopeImplementer* handle_scope_implementer = \
87 isolate->handle_scope_implementer(); \ 87 isolate->handle_scope_implementer(); \
88 handle_scope_implementer->DecrementCallDepth(); \ 88 handle_scope_implementer->DecrementCallDepth(); \
89 if (has_pending_exception) { \ 89 if (has_pending_exception) { \
90 if (handle_scope_implementer->CallDepthIsZero() && \ 90 if (handle_scope_implementer->CallDepthIsZero() && \
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 * out of memory at some point this check will fail. It should be called on 242 * out of memory at some point this check will fail. It should be called on
243 * entry to all methods that touch anything in the heap, except destructors 243 * entry to all methods that touch anything in the heap, except destructors
244 * which you sometimes can't avoid calling after the vm has crashed. Functions 244 * which you sometimes can't avoid calling after the vm has crashed. Functions
245 * that call EnsureInitialized or ON_BAILOUT don't have to also call 245 * that call EnsureInitialized or ON_BAILOUT don't have to also call
246 * IsDeadCheck. ON_BAILOUT has the advantage over EnsureInitialized that you 246 * IsDeadCheck. ON_BAILOUT has the advantage over EnsureInitialized that you
247 * can arrange to return if the VM is dead. This is needed to ensure that no VM 247 * can arrange to return if the VM is dead. This is needed to ensure that no VM
248 * heap allocations are attempted on a dead VM. EnsureInitialized has the 248 * heap allocations are attempted on a dead VM. EnsureInitialized has the
249 * advantage over ON_BAILOUT that it actually initializes the VM if this has not 249 * advantage over ON_BAILOUT that it actually initializes the VM if this has not
250 * yet been done. 250 * yet been done.
251 */ 251 */
252 static inline bool IsDeadCheck(const char* location) { 252 static inline bool IsDeadCheck(i::Isolate* isolate, const char* location) {
253 return !i::Isolate::Current()->IsInitialized() 253 return !isolate->IsInitialized()
254 && i::V8::IsDead() ? ReportV8Dead(location) : false; 254 && i::V8::IsDead() ? ReportV8Dead(location) : false;
255 } 255 }
256 256
257 257
258 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) { 258 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) {
259 return obj.IsEmpty() ? ReportEmptyHandle(location) : false; 259 return obj.IsEmpty() ? ReportEmptyHandle(location) : false;
260 } 260 }
261 261
262 262
263 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { 263 static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
264 return (obj == 0) ? ReportEmptyHandle(location) : false; 264 return (obj == 0) ? ReportEmptyHandle(location) : false;
265 } 265 }
266 266
267 // --- S t a t i c s --- 267 // --- S t a t i c s ---
268 268
269 269
270 static bool InitializeHelper() { 270 static bool InitializeHelper() {
271 if (i::Snapshot::Initialize()) return true; 271 if (i::Snapshot::Initialize()) return true;
272 return i::V8::Initialize(NULL); 272 return i::V8::Initialize(NULL);
273 } 273 }
274 274
275 275
276 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate, 276 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
277 const char* location) { 277 const char* location) {
278 if (IsDeadCheck(location)) return false; 278 if (IsDeadCheck(isolate, location)) return false;
279 if (isolate != NULL) { 279 if (isolate != NULL) {
280 if (isolate->IsInitialized()) return true; 280 if (isolate->IsInitialized()) return true;
281 } 281 }
282 return ApiCheck(InitializeHelper(), location, "Error initializing V8"); 282 return ApiCheck(InitializeHelper(), location, "Error initializing V8");
283 } 283 }
284 284
285 static inline bool EnsureInitialized(const char* location) { 285 static inline bool EnsureInitialized(const char* location) {
286 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 286 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
287 return EnsureInitializedForIsolate(isolate, location); 287 return EnsureInitializedForIsolate(isolate, location);
288 } 288 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (!EnsureInitialized("v8::True()")) return v8::Handle<v8::Boolean>(); 338 if (!EnsureInitialized("v8::True()")) return v8::Handle<v8::Boolean>();
339 return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->true_value())); 339 return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->true_value()));
340 } 340 }
341 341
342 342
343 v8::Handle<v8::Boolean> ImplementationUtilities::False() { 343 v8::Handle<v8::Boolean> ImplementationUtilities::False() {
344 if (!EnsureInitialized("v8::False()")) return v8::Handle<v8::Boolean>(); 344 if (!EnsureInitialized("v8::False()")) return v8::Handle<v8::Boolean>();
345 return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->false_value())); 345 return v8::Handle<v8::Boolean>(ToApi<Boolean>(FACTORY->false_value()));
346 } 346 }
347 347
348
349 void V8::SetFlagsFromString(const char* str, int length) { 348 void V8::SetFlagsFromString(const char* str, int length) {
350 i::FlagList::SetFlagsFromString(str, length); 349 i::FlagList::SetFlagsFromString(str, length);
351 } 350 }
352 351
353 352
354 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { 353 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
355 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); 354 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
356 } 355 }
357 356
358 357
359 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) { 358 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) {
360 if (IsDeadCheck("v8::ThrowException()")) return v8::Handle<Value>(); 359 i::Isolate* isolate = i::Isolate::Current();
360 if (IsDeadCheck(isolate, "v8::ThrowException()")) {
361 return v8::Handle<Value>();
362 }
361 ENTER_V8; 363 ENTER_V8;
362 // If we're passed an empty handle, we throw an undefined exception 364 // If we're passed an empty handle, we throw an undefined exception
363 // to deal more gracefully with out of memory situations. 365 // to deal more gracefully with out of memory situations.
364 if (value.IsEmpty()) { 366 if (value.IsEmpty()) {
365 i::Isolate::Current()->ScheduleThrow(HEAP->undefined_value()); 367 isolate->ScheduleThrow(HEAP->undefined_value());
366 } else { 368 } else {
367 i::Isolate::Current()->ScheduleThrow(*Utils::OpenHandle(*value)); 369 isolate->ScheduleThrow(*Utils::OpenHandle(*value));
368 } 370 }
369 return v8::Undefined(); 371 return v8::Undefined();
370 } 372 }
371 373
372 374
373 RegisteredExtension* RegisteredExtension::first_extension_ = NULL; 375 RegisteredExtension* RegisteredExtension::first_extension_ = NULL;
374 376
375 377
376 RegisteredExtension::RegisteredExtension(Extension* extension) 378 RegisteredExtension::RegisteredExtension(Extension* extension)
377 : extension_(extension), state_(UNVISITED) { } 379 : extension_(extension), state_(UNVISITED) { }
(...skipping 16 matching lines...) Expand all
394 int dep_count, 396 int dep_count,
395 const char** deps) 397 const char** deps)
396 : name_(name), 398 : name_(name),
397 source_(source), 399 source_(source),
398 dep_count_(dep_count), 400 dep_count_(dep_count),
399 deps_(deps), 401 deps_(deps),
400 auto_enable_(false) { } 402 auto_enable_(false) { }
401 403
402 404
403 v8::Handle<Primitive> Undefined() { 405 v8::Handle<Primitive> Undefined() {
404 LOG_API("Undefined"); 406 i::Isolate* isolate = i::Isolate::Current();
407 LOG_API(isolate, "Undefined");
405 return ImplementationUtilities::Undefined(); 408 return ImplementationUtilities::Undefined();
406 } 409 }
407 410
408 411
409 v8::Handle<Primitive> Null() { 412 v8::Handle<Primitive> Null() {
410 LOG_API("Null"); 413 i::Isolate* isolate = i::Isolate::Current();
414 LOG_API(isolate, "Null");
411 return ImplementationUtilities::Null(); 415 return ImplementationUtilities::Null();
412 } 416 }
413 417
414 418
415 v8::Handle<Boolean> True() { 419 v8::Handle<Boolean> True() {
416 LOG_API("True"); 420 i::Isolate* isolate = i::Isolate::Current();
421 LOG_API(isolate, "True");
417 return ImplementationUtilities::True(); 422 return ImplementationUtilities::True();
418 } 423 }
419 424
420 425
421 v8::Handle<Boolean> False() { 426 v8::Handle<Boolean> False() {
422 LOG_API("False"); 427 i::Isolate* isolate = i::Isolate::Current();
428 LOG_API(isolate, "False");
423 return ImplementationUtilities::False(); 429 return ImplementationUtilities::False();
424 } 430 }
425 431
426 432
427 ResourceConstraints::ResourceConstraints() 433 ResourceConstraints::ResourceConstraints()
428 : max_young_space_size_(0), 434 : max_young_space_size_(0),
429 max_old_space_size_(0), 435 max_old_space_size_(0),
430 max_executable_size_(0), 436 max_executable_size_(0),
431 stack_limit_(NULL) { } 437 stack_limit_(NULL) { }
432 438
(...skipping 14 matching lines...) Expand all
447 } 453 }
448 if (constraints->stack_limit() != NULL) { 454 if (constraints->stack_limit() != NULL) {
449 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); 455 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
450 isolate->stack_guard()->SetStackLimit(limit); 456 isolate->stack_guard()->SetStackLimit(limit);
451 } 457 }
452 return true; 458 return true;
453 } 459 }
454 460
455 461
456 i::Object** V8::GlobalizeReference(i::Object** obj) { 462 i::Object** V8::GlobalizeReference(i::Object** obj) {
457 if (IsDeadCheck("V8::Persistent::New")) return NULL; 463 i::Isolate* isolate = i::Isolate::Current();
458 LOG_API("Persistent::New"); 464 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL;
465 LOG_API(isolate, "Persistent::New");
459 i::Handle<i::Object> result = 466 i::Handle<i::Object> result =
460 i::Isolate::Current()->global_handles()->Create(*obj); 467 isolate->global_handles()->Create(*obj);
461 return result.location(); 468 return result.location();
462 } 469 }
463 470
464 471
465 void V8::MakeWeak(i::Object** object, void* parameters, 472 void V8::MakeWeak(i::Object** object, void* parameters,
466 WeakReferenceCallback callback) { 473 WeakReferenceCallback callback) {
467 LOG_API("MakeWeak"); 474 i::Isolate* isolate = i::Isolate::Current();
468 i::Isolate::Current()->global_handles()->MakeWeak(object, parameters, 475 LOG_API(isolate, "MakeWeak");
476 isolate->global_handles()->MakeWeak(object, parameters,
469 callback); 477 callback);
470 } 478 }
471 479
472 480
473 void V8::ClearWeak(i::Object** obj) { 481 void V8::ClearWeak(i::Object** obj) {
474 LOG_API("ClearWeak"); 482 i::Isolate* isolate = i::Isolate::Current();
475 i::Isolate::Current()->global_handles()->ClearWeakness(obj); 483 LOG_API(isolate, "ClearWeak");
484 isolate->global_handles()->ClearWeakness(obj);
476 } 485 }
477 486
478 487
479 bool V8::IsGlobalNearDeath(i::Object** obj) { 488 bool V8::IsGlobalNearDeath(i::Object** obj) {
480 LOG_API("IsGlobalNearDeath"); 489 i::Isolate* isolate = i::Isolate::Current();
481 if (!i::Isolate::Current()->IsInitialized()) return false; 490 LOG_API(isolate, "IsGlobalNearDeath");
491 if (!isolate->IsInitialized()) return false;
482 return i::GlobalHandles::IsNearDeath(obj); 492 return i::GlobalHandles::IsNearDeath(obj);
483 } 493 }
484 494
485 495
486 bool V8::IsGlobalWeak(i::Object** obj) { 496 bool V8::IsGlobalWeak(i::Object** obj) {
487 LOG_API("IsGlobalWeak"); 497 i::Isolate* isolate = i::Isolate::Current();
488 if (!i::Isolate::Current()->IsInitialized()) return false; 498 LOG_API(isolate, "IsGlobalWeak");
499 if (!isolate->IsInitialized()) return false;
489 return i::GlobalHandles::IsWeak(obj); 500 return i::GlobalHandles::IsWeak(obj);
490 } 501 }
491 502
492 503
493 void V8::DisposeGlobal(i::Object** obj) { 504 void V8::DisposeGlobal(i::Object** obj) {
494 LOG_API("DisposeGlobal"); 505 i::Isolate* isolate = i::Isolate::Current();
495 if (!i::Isolate::Current()->IsInitialized()) return; 506 LOG_API(isolate, "DisposeGlobal");
496 i::Isolate::Current()->global_handles()->Destroy(obj); 507 if (!isolate->IsInitialized()) return;
508 isolate->global_handles()->Destroy(obj);
497 } 509 }
498 510
499 // --- H a n d l e s --- 511 // --- H a n d l e s ---
500 512
501 513
502 HandleScope::HandleScope() { 514 HandleScope::HandleScope() {
503 API_ENTRY_CHECK("HandleScope::HandleScope"); 515 API_ENTRY_CHECK("HandleScope::HandleScope");
504 i::Isolate* isolate = i::Isolate::Current(); 516 i::Isolate* isolate = i::Isolate::Current();
505 v8::ImplementationUtilities::HandleScopeData* current = 517 v8::ImplementationUtilities::HandleScopeData* current =
506 isolate->handle_scope_data(); 518 isolate->handle_scope_data();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 561
550 562
551 i::Object** HandleScope::CreateHandle(i::HeapObject* value) { 563 i::Object** HandleScope::CreateHandle(i::HeapObject* value) {
552 ASSERT(value->IsHeapObject()); 564 ASSERT(value->IsHeapObject());
553 return reinterpret_cast<i::Object**>( 565 return reinterpret_cast<i::Object**>(
554 i::HandleScope::CreateHandle(value, value->GetIsolate())); 566 i::HandleScope::CreateHandle(value, value->GetIsolate()));
555 } 567 }
556 568
557 569
558 void Context::Enter() { 570 void Context::Enter() {
559 if (IsDeadCheck("v8::Context::Enter()")) return; 571 // TODO(isolates): Context should have a pointer to isolate.
572 i::Isolate* isolate = i::Isolate::Current();
573 if (IsDeadCheck(isolate, "v8::Context::Enter()")) return;
560 ENTER_V8; 574 ENTER_V8;
561 i::Handle<i::Context> env = Utils::OpenHandle(this); 575 i::Handle<i::Context> env = Utils::OpenHandle(this);
562 // TODO(isolates): Context should have a pointer to isolate.
563 i::Isolate* isolate = i::Isolate::Current();
564 isolate->handle_scope_implementer()->EnterContext(env); 576 isolate->handle_scope_implementer()->EnterContext(env);
565 577
566 isolate->handle_scope_implementer()->SaveContext(isolate->context()); 578 isolate->handle_scope_implementer()->SaveContext(isolate->context());
567 isolate->set_context(*env); 579 isolate->set_context(*env);
568 } 580 }
569 581
570 582
571 void Context::Exit() { 583 void Context::Exit() {
572 if (!i::Isolate::Current()->IsInitialized()) return;
573 // TODO(isolates): Context should have a pointer to isolate. 584 // TODO(isolates): Context should have a pointer to isolate.
574 i::Isolate* isolate = i::Isolate::Current(); 585 i::Isolate* isolate = i::Isolate::Current();
586 if (!isolate->IsInitialized()) return;
575 587
576 if (!ApiCheck(isolate->handle_scope_implementer()->LeaveLastContext(), 588 if (!ApiCheck(isolate->handle_scope_implementer()->LeaveLastContext(),
577 "v8::Context::Exit()", 589 "v8::Context::Exit()",
578 "Cannot exit non-entered context")) { 590 "Cannot exit non-entered context")) {
579 return; 591 return;
580 } 592 }
581 593
582 // Content of 'last_context' could be NULL. 594 // Content of 'last_context' could be NULL.
583 i::Context* last_context = 595 i::Context* last_context =
584 isolate->handle_scope_implementer()->RestoreContext(); 596 isolate->handle_scope_implementer()->RestoreContext();
585 isolate->set_context(last_context); 597 isolate->set_context(last_context);
586 } 598 }
587 599
588 600
589 void Context::SetData(v8::Handle<String> data) { 601 void Context::SetData(v8::Handle<String> data) {
590 if (IsDeadCheck("v8::Context::SetData()")) return; 602 // TODO(isolates): Context should have a pointer to isolate.
603 i::Isolate* isolate = i::Isolate::Current();
604 if (IsDeadCheck(isolate, "v8::Context::SetData()")) return;
591 ENTER_V8; 605 ENTER_V8;
592 { 606 {
593 HandleScope scope; 607 i::HandleScope scope(isolate);
594 i::Handle<i::Context> env = Utils::OpenHandle(this); 608 i::Handle<i::Context> env = Utils::OpenHandle(this);
595 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data); 609 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
596 ASSERT(env->IsGlobalContext()); 610 ASSERT(env->IsGlobalContext());
597 if (env->IsGlobalContext()) { 611 if (env->IsGlobalContext()) {
598 env->set_data(*raw_data); 612 env->set_data(*raw_data);
599 } 613 }
600 } 614 }
601 } 615 }
602 616
603 617
604 v8::Local<v8::Value> Context::GetData() { 618 v8::Local<v8::Value> Context::GetData() {
605 if (IsDeadCheck("v8::Context::GetData()")) return v8::Local<Value>(); 619 // TODO(isolates): Context should have a pointer to isolate.
620 i::Isolate* isolate = i::Isolate::Current();
621 if (IsDeadCheck(isolate, "v8::Context::GetData()")) {
622 return v8::Local<Value>();
623 }
606 ENTER_V8; 624 ENTER_V8;
607 i::Object* raw_result = NULL; 625 i::Object* raw_result = NULL;
608 { 626 {
609 HandleScope scope; 627 i::HandleScope scope(isolate);
610 i::Handle<i::Context> env = Utils::OpenHandle(this); 628 i::Handle<i::Context> env = Utils::OpenHandle(this);
611 ASSERT(env->IsGlobalContext()); 629 ASSERT(env->IsGlobalContext());
612 if (env->IsGlobalContext()) { 630 if (env->IsGlobalContext()) {
613 raw_result = env->data(); 631 raw_result = env->data();
614 } else { 632 } else {
615 return Local<Value>(); 633 return Local<Value>();
616 } 634 }
617 } 635 }
618 i::Handle<i::Object> result(raw_result); 636 i::Handle<i::Object> result(raw_result);
619 return Utils::ToLocal(result); 637 return Utils::ToLocal(result);
620 } 638 }
621 639
622 640
623 i::Object** v8::HandleScope::RawClose(i::Object** value) { 641 i::Object** v8::HandleScope::RawClose(i::Object** value) {
624 if (!ApiCheck(!is_closed_, 642 if (!ApiCheck(!is_closed_,
625 "v8::HandleScope::Close()", 643 "v8::HandleScope::Close()",
626 "Local scope has already been closed")) { 644 "Local scope has already been closed")) {
627 return 0; 645 return 0;
628 } 646 }
629 LOG_API("CloseHandleScope"); 647 LOG_API(isolate_, "CloseHandleScope");
630 648
631 // Read the result before popping the handle block. 649 // Read the result before popping the handle block.
632 i::Object* result = NULL; 650 i::Object* result = NULL;
633 if (value != NULL) { 651 if (value != NULL) {
634 result = *value; 652 result = *value;
635 } 653 }
636 is_closed_ = true; 654 is_closed_ = true;
637 Leave(); 655 Leave();
638 656
639 if (value == NULL) { 657 if (value == NULL) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // --- T e m p l a t e --- 731 // --- T e m p l a t e ---
714 732
715 733
716 static void InitializeTemplate(i::Handle<i::TemplateInfo> that, int type) { 734 static void InitializeTemplate(i::Handle<i::TemplateInfo> that, int type) {
717 that->set_tag(i::Smi::FromInt(type)); 735 that->set_tag(i::Smi::FromInt(type));
718 } 736 }
719 737
720 738
721 void Template::Set(v8::Handle<String> name, v8::Handle<Data> value, 739 void Template::Set(v8::Handle<String> name, v8::Handle<Data> value,
722 v8::PropertyAttribute attribute) { 740 v8::PropertyAttribute attribute) {
723 if (IsDeadCheck("v8::Template::Set()")) return; 741 i::Isolate* isolate = i::Isolate::Current();
742 if (IsDeadCheck(isolate, "v8::Template::Set()")) return;
724 ENTER_V8; 743 ENTER_V8;
725 HandleScope scope; 744 i::HandleScope scope(isolate);
726 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list()); 745 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_list());
727 if (list->IsUndefined()) { 746 if (list->IsUndefined()) {
728 list = NeanderArray().value(); 747 list = NeanderArray().value();
729 Utils::OpenHandle(this)->set_property_list(*list); 748 Utils::OpenHandle(this)->set_property_list(*list);
730 } 749 }
731 NeanderArray array(list); 750 NeanderArray array(list);
732 array.add(Utils::OpenHandle(*name)); 751 array.add(Utils::OpenHandle(*name));
733 array.add(Utils::OpenHandle(*value)); 752 array.add(Utils::OpenHandle(*value));
734 array.add(Utils::OpenHandle(*v8::Integer::New(attribute))); 753 array.add(Utils::OpenHandle(*v8::Integer::New(attribute)));
735 } 754 }
736 755
737 756
738 // --- F u n c t i o n T e m p l a t e --- 757 // --- F u n c t i o n T e m p l a t e ---
739 static void InitializeFunctionTemplate( 758 static void InitializeFunctionTemplate(
740 i::Handle<i::FunctionTemplateInfo> info) { 759 i::Handle<i::FunctionTemplateInfo> info) {
741 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE)); 760 info->set_tag(i::Smi::FromInt(Consts::FUNCTION_TEMPLATE));
742 info->set_flag(0); 761 info->set_flag(0);
743 } 762 }
744 763
745 764
746 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { 765 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
747 if (IsDeadCheck("v8::FunctionTemplate::PrototypeTemplate()")) { 766 i::Isolate* isolate = i::Isolate::Current();
767 if (IsDeadCheck(isolate, "v8::FunctionTemplate::PrototypeTemplate()")) {
748 return Local<ObjectTemplate>(); 768 return Local<ObjectTemplate>();
749 } 769 }
750 ENTER_V8; 770 ENTER_V8;
751 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template()); 771 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template());
752 if (result->IsUndefined()) { 772 if (result->IsUndefined()) {
753 result = Utils::OpenHandle(*ObjectTemplate::New()); 773 result = Utils::OpenHandle(*ObjectTemplate::New());
754 Utils::OpenHandle(this)->set_prototype_template(*result); 774 Utils::OpenHandle(this)->set_prototype_template(*result);
755 } 775 }
756 return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result)); 776 return Local<ObjectTemplate>(ToApi<ObjectTemplate>(result));
757 } 777 }
758 778
759 779
760 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { 780 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) {
761 if (IsDeadCheck("v8::FunctionTemplate::Inherit()")) return; 781 i::Isolate* isolate = i::Isolate::Current();
782 if (IsDeadCheck(isolate, "v8::FunctionTemplate::Inherit()")) return;
762 ENTER_V8; 783 ENTER_V8;
763 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); 784 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value));
764 } 785 }
765 786
766 787
767 Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback, 788 Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback,
768 v8::Handle<Value> data, v8::Handle<Signature> signature) { 789 v8::Handle<Value> data, v8::Handle<Signature> signature) {
769 EnsureInitialized("v8::FunctionTemplate::New()"); 790 i::Isolate* isolate = i::Isolate::Current();
770 LOG_API("FunctionTemplate::New"); 791 EnsureInitializedForIsolate(isolate, "v8::FunctionTemplate::New()");
792 LOG_API(isolate, "FunctionTemplate::New");
771 ENTER_V8; 793 ENTER_V8;
772 i::Isolate* isolate = i::Isolate::Current();
773 i::Handle<i::Struct> struct_obj = 794 i::Handle<i::Struct> struct_obj =
774 FACTORY->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE); 795 FACTORY->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
775 i::Handle<i::FunctionTemplateInfo> obj = 796 i::Handle<i::FunctionTemplateInfo> obj =
776 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj); 797 i::Handle<i::FunctionTemplateInfo>::cast(struct_obj);
777 InitializeFunctionTemplate(obj); 798 InitializeFunctionTemplate(obj);
778 int next_serial_number = isolate->next_serial_number(); 799 int next_serial_number = isolate->next_serial_number();
779 isolate->set_next_serial_number(next_serial_number + 1); 800 isolate->set_next_serial_number(next_serial_number + 1);
780 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); 801 obj->set_serial_number(i::Smi::FromInt(next_serial_number));
781 if (callback != 0) { 802 if (callback != 0) {
782 if (data.IsEmpty()) data = v8::Undefined(); 803 if (data.IsEmpty()) data = v8::Undefined();
783 Utils::ToLocal(obj)->SetCallHandler(callback, data); 804 Utils::ToLocal(obj)->SetCallHandler(callback, data);
784 } 805 }
785 obj->set_undetectable(false); 806 obj->set_undetectable(false);
786 obj->set_needs_access_check(false); 807 obj->set_needs_access_check(false);
787 808
788 if (!signature.IsEmpty()) 809 if (!signature.IsEmpty())
789 obj->set_signature(*Utils::OpenHandle(*signature)); 810 obj->set_signature(*Utils::OpenHandle(*signature));
790 return Utils::ToLocal(obj); 811 return Utils::ToLocal(obj);
791 } 812 }
792 813
793 814
794 Local<Signature> Signature::New(Handle<FunctionTemplate> receiver, 815 Local<Signature> Signature::New(Handle<FunctionTemplate> receiver,
795 int argc, Handle<FunctionTemplate> argv[]) { 816 int argc, Handle<FunctionTemplate> argv[]) {
796 EnsureInitialized("v8::Signature::New()"); 817 i::Isolate* isolate = i::Isolate::Current();
797 LOG_API("Signature::New"); 818 EnsureInitializedForIsolate(isolate, "v8::Signature::New()");
819 LOG_API(isolate, "Signature::New");
798 ENTER_V8; 820 ENTER_V8;
799 i::Handle<i::Struct> struct_obj = 821 i::Handle<i::Struct> struct_obj =
800 FACTORY->NewStruct(i::SIGNATURE_INFO_TYPE); 822 FACTORY->NewStruct(i::SIGNATURE_INFO_TYPE);
801 i::Handle<i::SignatureInfo> obj = 823 i::Handle<i::SignatureInfo> obj =
802 i::Handle<i::SignatureInfo>::cast(struct_obj); 824 i::Handle<i::SignatureInfo>::cast(struct_obj);
803 if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver)); 825 if (!receiver.IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver));
804 if (argc > 0) { 826 if (argc > 0) {
805 i::Handle<i::FixedArray> args = FACTORY->NewFixedArray(argc); 827 i::Handle<i::FixedArray> args = FACTORY->NewFixedArray(argc);
806 for (int i = 0; i < argc; i++) { 828 for (int i = 0; i < argc; i++) {
807 if (!argv[i].IsEmpty()) 829 if (!argv[i].IsEmpty())
808 args->set(i, *Utils::OpenHandle(*argv[i])); 830 args->set(i, *Utils::OpenHandle(*argv[i]));
809 } 831 }
810 obj->set_args(*args); 832 obj->set_args(*args);
811 } 833 }
812 return Utils::ToLocal(obj); 834 return Utils::ToLocal(obj);
813 } 835 }
814 836
815 837
816 Local<TypeSwitch> TypeSwitch::New(Handle<FunctionTemplate> type) { 838 Local<TypeSwitch> TypeSwitch::New(Handle<FunctionTemplate> type) {
817 Handle<FunctionTemplate> types[1] = { type }; 839 Handle<FunctionTemplate> types[1] = { type };
818 return TypeSwitch::New(1, types); 840 return TypeSwitch::New(1, types);
819 } 841 }
820 842
821 843
822 Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) { 844 Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) {
823 EnsureInitialized("v8::TypeSwitch::New()"); 845 i::Isolate* isolate = i::Isolate::Current();
824 LOG_API("TypeSwitch::New"); 846 EnsureInitializedForIsolate(isolate, "v8::TypeSwitch::New()");
847 LOG_API(isolate, "TypeSwitch::New");
825 ENTER_V8; 848 ENTER_V8;
826 i::Handle<i::FixedArray> vector = FACTORY->NewFixedArray(argc); 849 i::Handle<i::FixedArray> vector = isolate->factory()->NewFixedArray(argc);
827 for (int i = 0; i < argc; i++) 850 for (int i = 0; i < argc; i++)
828 vector->set(i, *Utils::OpenHandle(*types[i])); 851 vector->set(i, *Utils::OpenHandle(*types[i]));
829 i::Handle<i::Struct> struct_obj = 852 i::Handle<i::Struct> struct_obj =
830 FACTORY->NewStruct(i::TYPE_SWITCH_INFO_TYPE); 853 isolate->factory()->NewStruct(i::TYPE_SWITCH_INFO_TYPE);
831 i::Handle<i::TypeSwitchInfo> obj = 854 i::Handle<i::TypeSwitchInfo> obj =
832 i::Handle<i::TypeSwitchInfo>::cast(struct_obj); 855 i::Handle<i::TypeSwitchInfo>::cast(struct_obj);
833 obj->set_types(*vector); 856 obj->set_types(*vector);
834 return Utils::ToLocal(obj); 857 return Utils::ToLocal(obj);
835 } 858 }
836 859
837 860
838 int TypeSwitch::match(v8::Handle<Value> value) { 861 int TypeSwitch::match(v8::Handle<Value> value) {
839 LOG_API("TypeSwitch::match"); 862 i::Isolate* isolate = i::Isolate::Current();
863 LOG_API(isolate, "TypeSwitch::match");
840 i::Handle<i::Object> obj = Utils::OpenHandle(*value); 864 i::Handle<i::Object> obj = Utils::OpenHandle(*value);
841 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); 865 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this);
842 i::FixedArray* types = i::FixedArray::cast(info->types()); 866 i::FixedArray* types = i::FixedArray::cast(info->types());
843 for (int i = 0; i < types->length(); i++) { 867 for (int i = 0; i < types->length(); i++) {
844 if (obj->IsInstanceOf(i::FunctionTemplateInfo::cast(types->get(i)))) 868 if (obj->IsInstanceOf(i::FunctionTemplateInfo::cast(types->get(i))))
845 return i + 1; 869 return i + 1;
846 } 870 }
847 return 0; 871 return 0;
848 } 872 }
849 873
850 874
851 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ 875 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
852 i::Handle<i::Object> proxy = FromCData(cdata); \ 876 i::Handle<i::Object> proxy = FromCData(cdata); \
853 (obj)->setter(*proxy); \ 877 (obj)->setter(*proxy); \
854 } while (false) 878 } while (false)
855 879
856 880
857 void FunctionTemplate::SetCallHandler(InvocationCallback callback, 881 void FunctionTemplate::SetCallHandler(InvocationCallback callback,
858 v8::Handle<Value> data) { 882 v8::Handle<Value> data) {
859 if (IsDeadCheck("v8::FunctionTemplate::SetCallHandler()")) return; 883 i::Isolate* isolate = i::Isolate::Current();
884 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetCallHandler()")) return;
860 ENTER_V8; 885 ENTER_V8;
861 HandleScope scope; 886 i::HandleScope scope(isolate);
862 i::Handle<i::Struct> struct_obj = 887 i::Handle<i::Struct> struct_obj =
863 FACTORY->NewStruct(i::CALL_HANDLER_INFO_TYPE); 888 FACTORY->NewStruct(i::CALL_HANDLER_INFO_TYPE);
864 i::Handle<i::CallHandlerInfo> obj = 889 i::Handle<i::CallHandlerInfo> obj =
865 i::Handle<i::CallHandlerInfo>::cast(struct_obj); 890 i::Handle<i::CallHandlerInfo>::cast(struct_obj);
866 SET_FIELD_WRAPPED(obj, set_callback, callback); 891 SET_FIELD_WRAPPED(obj, set_callback, callback);
867 if (data.IsEmpty()) data = v8::Undefined(); 892 if (data.IsEmpty()) data = v8::Undefined();
868 obj->set_data(*Utils::OpenHandle(*data)); 893 obj->set_data(*Utils::OpenHandle(*data));
869 Utils::OpenHandle(this)->set_call_code(*obj); 894 Utils::OpenHandle(this)->set_call_code(*obj);
870 } 895 }
871 896
(...skipping 20 matching lines...) Expand all
892 } 917 }
893 918
894 919
895 void FunctionTemplate::AddInstancePropertyAccessor( 920 void FunctionTemplate::AddInstancePropertyAccessor(
896 v8::Handle<String> name, 921 v8::Handle<String> name,
897 AccessorGetter getter, 922 AccessorGetter getter,
898 AccessorSetter setter, 923 AccessorSetter setter,
899 v8::Handle<Value> data, 924 v8::Handle<Value> data,
900 v8::AccessControl settings, 925 v8::AccessControl settings,
901 v8::PropertyAttribute attributes) { 926 v8::PropertyAttribute attributes) {
902 if (IsDeadCheck("v8::FunctionTemplate::AddInstancePropertyAccessor()")) { 927 i::Isolate* isolate = i::Isolate::Current();
928 if (IsDeadCheck(isolate,
929 "v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
903 return; 930 return;
904 } 931 }
905 ENTER_V8; 932 ENTER_V8;
906 HandleScope scope; 933 i::HandleScope scope(isolate);
907 934
908 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name, 935 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name,
909 getter, setter, data, 936 getter, setter, data,
910 settings, attributes); 937 settings, attributes);
911 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors()); 938 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors());
912 if (list->IsUndefined()) { 939 if (list->IsUndefined()) {
913 list = NeanderArray().value(); 940 list = NeanderArray().value();
914 Utils::OpenHandle(this)->set_property_accessors(*list); 941 Utils::OpenHandle(this)->set_property_accessors(*list);
915 } 942 }
916 NeanderArray array(list); 943 NeanderArray array(list);
917 array.add(obj); 944 array.add(obj);
918 } 945 }
919 946
920 947
921 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { 948 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
922 if (IsDeadCheck("v8::FunctionTemplate::InstanceTemplate()") 949 i::Isolate* isolate = i::Isolate::Current();
950 if (IsDeadCheck(isolate, "v8::FunctionTemplate::InstanceTemplate()")
923 || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this)) 951 || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this))
924 return Local<ObjectTemplate>(); 952 return Local<ObjectTemplate>();
925 ENTER_V8; 953 ENTER_V8;
926 if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) { 954 if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) {
927 Local<ObjectTemplate> templ = 955 Local<ObjectTemplate> templ =
928 ObjectTemplate::New(v8::Handle<FunctionTemplate>(this)); 956 ObjectTemplate::New(v8::Handle<FunctionTemplate>(this));
929 Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ)); 957 Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ));
930 } 958 }
931 i::Handle<i::ObjectTemplateInfo> result(i::ObjectTemplateInfo::cast( 959 i::Handle<i::ObjectTemplateInfo> result(i::ObjectTemplateInfo::cast(
932 Utils::OpenHandle(this)->instance_template())); 960 Utils::OpenHandle(this)->instance_template()));
933 return Utils::ToLocal(result); 961 return Utils::ToLocal(result);
934 } 962 }
935 963
936 964
937 void FunctionTemplate::SetClassName(Handle<String> name) { 965 void FunctionTemplate::SetClassName(Handle<String> name) {
938 if (IsDeadCheck("v8::FunctionTemplate::SetClassName()")) return; 966 i::Isolate* isolate = i::Isolate::Current();
967 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetClassName()")) return;
939 ENTER_V8; 968 ENTER_V8;
940 Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name)); 969 Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name));
941 } 970 }
942 971
943 972
944 void FunctionTemplate::SetHiddenPrototype(bool value) { 973 void FunctionTemplate::SetHiddenPrototype(bool value) {
945 if (IsDeadCheck("v8::FunctionTemplate::SetHiddenPrototype()")) return; 974 i::Isolate* isolate = i::Isolate::Current();
975 if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetHiddenPrototype()")) {
976 return;
977 }
946 ENTER_V8; 978 ENTER_V8;
947 Utils::OpenHandle(this)->set_hidden_prototype(value); 979 Utils::OpenHandle(this)->set_hidden_prototype(value);
948 } 980 }
949 981
950 982
951 void FunctionTemplate::SetNamedInstancePropertyHandler( 983 void FunctionTemplate::SetNamedInstancePropertyHandler(
952 NamedPropertyGetter getter, 984 NamedPropertyGetter getter,
953 NamedPropertySetter setter, 985 NamedPropertySetter setter,
954 NamedPropertyQuery query, 986 NamedPropertyQuery query,
955 NamedPropertyDeleter remover, 987 NamedPropertyDeleter remover,
956 NamedPropertyEnumerator enumerator, 988 NamedPropertyEnumerator enumerator,
957 Handle<Value> data) { 989 Handle<Value> data) {
958 if (IsDeadCheck("v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) { 990 i::Isolate* isolate = i::Isolate::Current();
991 if (IsDeadCheck(isolate,
992 "v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
959 return; 993 return;
960 } 994 }
961 ENTER_V8; 995 ENTER_V8;
962 HandleScope scope; 996 i::HandleScope scope(isolate);
963 i::Handle<i::Struct> struct_obj = 997 i::Handle<i::Struct> struct_obj =
964 FACTORY->NewStruct(i::INTERCEPTOR_INFO_TYPE); 998 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
965 i::Handle<i::InterceptorInfo> obj = 999 i::Handle<i::InterceptorInfo> obj =
966 i::Handle<i::InterceptorInfo>::cast(struct_obj); 1000 i::Handle<i::InterceptorInfo>::cast(struct_obj);
967 1001
968 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); 1002 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter);
969 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); 1003 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter);
970 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); 1004 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query);
971 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); 1005 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
972 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); 1006 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
973 1007
974 if (data.IsEmpty()) data = v8::Undefined(); 1008 if (data.IsEmpty()) data = v8::Undefined();
975 obj->set_data(*Utils::OpenHandle(*data)); 1009 obj->set_data(*Utils::OpenHandle(*data));
976 Utils::OpenHandle(this)->set_named_property_handler(*obj); 1010 Utils::OpenHandle(this)->set_named_property_handler(*obj);
977 } 1011 }
978 1012
979 1013
980 void FunctionTemplate::SetIndexedInstancePropertyHandler( 1014 void FunctionTemplate::SetIndexedInstancePropertyHandler(
981 IndexedPropertyGetter getter, 1015 IndexedPropertyGetter getter,
982 IndexedPropertySetter setter, 1016 IndexedPropertySetter setter,
983 IndexedPropertyQuery query, 1017 IndexedPropertyQuery query,
984 IndexedPropertyDeleter remover, 1018 IndexedPropertyDeleter remover,
985 IndexedPropertyEnumerator enumerator, 1019 IndexedPropertyEnumerator enumerator,
986 Handle<Value> data) { 1020 Handle<Value> data) {
987 if (IsDeadCheck( 1021 i::Isolate* isolate = i::Isolate::Current();
1022 if (IsDeadCheck(isolate,
988 "v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) { 1023 "v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
989 return; 1024 return;
990 } 1025 }
991 ENTER_V8; 1026 ENTER_V8;
992 HandleScope scope; 1027 i::HandleScope scope(isolate);
993 i::Handle<i::Struct> struct_obj = 1028 i::Handle<i::Struct> struct_obj =
994 FACTORY->NewStruct(i::INTERCEPTOR_INFO_TYPE); 1029 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
995 i::Handle<i::InterceptorInfo> obj = 1030 i::Handle<i::InterceptorInfo> obj =
996 i::Handle<i::InterceptorInfo>::cast(struct_obj); 1031 i::Handle<i::InterceptorInfo>::cast(struct_obj);
997 1032
998 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); 1033 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter);
999 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); 1034 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter);
1000 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); 1035 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query);
1001 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); 1036 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
1002 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); 1037 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
1003 1038
1004 if (data.IsEmpty()) data = v8::Undefined(); 1039 if (data.IsEmpty()) data = v8::Undefined();
1005 obj->set_data(*Utils::OpenHandle(*data)); 1040 obj->set_data(*Utils::OpenHandle(*data));
1006 Utils::OpenHandle(this)->set_indexed_property_handler(*obj); 1041 Utils::OpenHandle(this)->set_indexed_property_handler(*obj);
1007 } 1042 }
1008 1043
1009 1044
1010 void FunctionTemplate::SetInstanceCallAsFunctionHandler( 1045 void FunctionTemplate::SetInstanceCallAsFunctionHandler(
1011 InvocationCallback callback, 1046 InvocationCallback callback,
1012 Handle<Value> data) { 1047 Handle<Value> data) {
1013 if (IsDeadCheck("v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) { 1048 i::Isolate* isolate = i::Isolate::Current();
1049 if (IsDeadCheck(isolate,
1050 "v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
1014 return; 1051 return;
1015 } 1052 }
1016 ENTER_V8; 1053 ENTER_V8;
1017 HandleScope scope; 1054 i::HandleScope scope(isolate);
1018 i::Handle<i::Struct> struct_obj = 1055 i::Handle<i::Struct> struct_obj =
1019 FACTORY->NewStruct(i::CALL_HANDLER_INFO_TYPE); 1056 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE);
1020 i::Handle<i::CallHandlerInfo> obj = 1057 i::Handle<i::CallHandlerInfo> obj =
1021 i::Handle<i::CallHandlerInfo>::cast(struct_obj); 1058 i::Handle<i::CallHandlerInfo>::cast(struct_obj);
1022 SET_FIELD_WRAPPED(obj, set_callback, callback); 1059 SET_FIELD_WRAPPED(obj, set_callback, callback);
1023 if (data.IsEmpty()) data = v8::Undefined(); 1060 if (data.IsEmpty()) data = v8::Undefined();
1024 obj->set_data(*Utils::OpenHandle(*data)); 1061 obj->set_data(*Utils::OpenHandle(*data));
1025 Utils::OpenHandle(this)->set_instance_call_handler(*obj); 1062 Utils::OpenHandle(this)->set_instance_call_handler(*obj);
1026 } 1063 }
1027 1064
1028 1065
1029 // --- O b j e c t T e m p l a t e --- 1066 // --- O b j e c t T e m p l a t e ---
1030 1067
1031 1068
1032 Local<ObjectTemplate> ObjectTemplate::New() { 1069 Local<ObjectTemplate> ObjectTemplate::New() {
1033 return New(Local<FunctionTemplate>()); 1070 return New(Local<FunctionTemplate>());
1034 } 1071 }
1035 1072
1036 1073
1037 Local<ObjectTemplate> ObjectTemplate::New( 1074 Local<ObjectTemplate> ObjectTemplate::New(
1038 v8::Handle<FunctionTemplate> constructor) { 1075 v8::Handle<FunctionTemplate> constructor) {
1039 if (IsDeadCheck("v8::ObjectTemplate::New()")) return Local<ObjectTemplate>(); 1076 i::Isolate* isolate = i::Isolate::Current();
1040 EnsureInitialized("v8::ObjectTemplate::New()"); 1077 if (IsDeadCheck(isolate, "v8::ObjectTemplate::New()")) {
1041 LOG_API("ObjectTemplate::New"); 1078 return Local<ObjectTemplate>();
1079 }
1080 EnsureInitializedForIsolate(isolate, "v8::ObjectTemplate::New()");
1081 LOG_API(isolate, "ObjectTemplate::New");
1042 ENTER_V8; 1082 ENTER_V8;
1043 i::Handle<i::Struct> struct_obj = 1083 i::Handle<i::Struct> struct_obj =
1044 FACTORY->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE); 1084 FACTORY->NewStruct(i::OBJECT_TEMPLATE_INFO_TYPE);
1045 i::Handle<i::ObjectTemplateInfo> obj = 1085 i::Handle<i::ObjectTemplateInfo> obj =
1046 i::Handle<i::ObjectTemplateInfo>::cast(struct_obj); 1086 i::Handle<i::ObjectTemplateInfo>::cast(struct_obj);
1047 InitializeTemplate(obj, Consts::OBJECT_TEMPLATE); 1087 InitializeTemplate(obj, Consts::OBJECT_TEMPLATE);
1048 if (!constructor.IsEmpty()) 1088 if (!constructor.IsEmpty())
1049 obj->set_constructor(*Utils::OpenHandle(*constructor)); 1089 obj->set_constructor(*Utils::OpenHandle(*constructor));
1050 obj->set_internal_field_count(i::Smi::FromInt(0)); 1090 obj->set_internal_field_count(i::Smi::FromInt(0));
1051 return Utils::ToLocal(obj); 1091 return Utils::ToLocal(obj);
(...skipping 11 matching lines...) Expand all
1063 } 1103 }
1064 } 1104 }
1065 1105
1066 1106
1067 void ObjectTemplate::SetAccessor(v8::Handle<String> name, 1107 void ObjectTemplate::SetAccessor(v8::Handle<String> name,
1068 AccessorGetter getter, 1108 AccessorGetter getter,
1069 AccessorSetter setter, 1109 AccessorSetter setter,
1070 v8::Handle<Value> data, 1110 v8::Handle<Value> data,
1071 AccessControl settings, 1111 AccessControl settings,
1072 PropertyAttribute attribute) { 1112 PropertyAttribute attribute) {
1073 if (IsDeadCheck("v8::ObjectTemplate::SetAccessor()")) return; 1113 i::Isolate* isolate = i::Isolate::Current();
1114 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessor()")) return;
1074 ENTER_V8; 1115 ENTER_V8;
1075 HandleScope scope; 1116 i::HandleScope scope(isolate);
1076 EnsureConstructor(this); 1117 EnsureConstructor(this);
1077 i::FunctionTemplateInfo* constructor = 1118 i::FunctionTemplateInfo* constructor =
1078 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1119 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1079 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1120 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1080 Utils::ToLocal(cons)->AddInstancePropertyAccessor(name, 1121 Utils::ToLocal(cons)->AddInstancePropertyAccessor(name,
1081 getter, 1122 getter,
1082 setter, 1123 setter,
1083 data, 1124 data,
1084 settings, 1125 settings,
1085 attribute); 1126 attribute);
1086 } 1127 }
1087 1128
1088 1129
1089 void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter, 1130 void ObjectTemplate::SetNamedPropertyHandler(NamedPropertyGetter getter,
1090 NamedPropertySetter setter, 1131 NamedPropertySetter setter,
1091 NamedPropertyQuery query, 1132 NamedPropertyQuery query,
1092 NamedPropertyDeleter remover, 1133 NamedPropertyDeleter remover,
1093 NamedPropertyEnumerator enumerator, 1134 NamedPropertyEnumerator enumerator,
1094 Handle<Value> data) { 1135 Handle<Value> data) {
1095 if (IsDeadCheck("v8::ObjectTemplate::SetNamedPropertyHandler()")) return; 1136 i::Isolate* isolate = i::Isolate::Current();
1137 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetNamedPropertyHandler()")) {
1138 return;
1139 }
1096 ENTER_V8; 1140 ENTER_V8;
1097 HandleScope scope; 1141 HandleScope scope;
1098 EnsureConstructor(this); 1142 EnsureConstructor(this);
1099 i::FunctionTemplateInfo* constructor = 1143 i::FunctionTemplateInfo* constructor =
1100 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1144 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1101 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1145 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1102 Utils::ToLocal(cons)->SetNamedInstancePropertyHandler(getter, 1146 Utils::ToLocal(cons)->SetNamedInstancePropertyHandler(getter,
1103 setter, 1147 setter,
1104 query, 1148 query,
1105 remover, 1149 remover,
1106 enumerator, 1150 enumerator,
1107 data); 1151 data);
1108 } 1152 }
1109 1153
1110 1154
1111 void ObjectTemplate::MarkAsUndetectable() { 1155 void ObjectTemplate::MarkAsUndetectable() {
1112 if (IsDeadCheck("v8::ObjectTemplate::MarkAsUndetectable()")) return; 1156 i::Isolate* isolate = i::Isolate::Current();
1157 if (IsDeadCheck(isolate, "v8::ObjectTemplate::MarkAsUndetectable()")) return;
1113 ENTER_V8; 1158 ENTER_V8;
1114 HandleScope scope; 1159 i::HandleScope scope(isolate);
1115 EnsureConstructor(this); 1160 EnsureConstructor(this);
1116 i::FunctionTemplateInfo* constructor = 1161 i::FunctionTemplateInfo* constructor =
1117 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1162 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1118 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1163 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1119 cons->set_undetectable(true); 1164 cons->set_undetectable(true);
1120 } 1165 }
1121 1166
1122 1167
1123 void ObjectTemplate::SetAccessCheckCallbacks( 1168 void ObjectTemplate::SetAccessCheckCallbacks(
1124 NamedSecurityCallback named_callback, 1169 NamedSecurityCallback named_callback,
1125 IndexedSecurityCallback indexed_callback, 1170 IndexedSecurityCallback indexed_callback,
1126 Handle<Value> data, 1171 Handle<Value> data,
1127 bool turned_on_by_default) { 1172 bool turned_on_by_default) {
1128 if (IsDeadCheck("v8::ObjectTemplate::SetAccessCheckCallbacks()")) return; 1173 i::Isolate* isolate = i::Isolate::Current();
1174 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetAccessCheckCallbacks()")) {
1175 return;
1176 }
1129 ENTER_V8; 1177 ENTER_V8;
1130 HandleScope scope; 1178 i::HandleScope scope(isolate);
1131 EnsureConstructor(this); 1179 EnsureConstructor(this);
1132 1180
1133 i::Handle<i::Struct> struct_info = 1181 i::Handle<i::Struct> struct_info =
1134 FACTORY->NewStruct(i::ACCESS_CHECK_INFO_TYPE); 1182 FACTORY->NewStruct(i::ACCESS_CHECK_INFO_TYPE);
1135 i::Handle<i::AccessCheckInfo> info = 1183 i::Handle<i::AccessCheckInfo> info =
1136 i::Handle<i::AccessCheckInfo>::cast(struct_info); 1184 i::Handle<i::AccessCheckInfo>::cast(struct_info);
1137 1185
1138 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); 1186 SET_FIELD_WRAPPED(info, set_named_callback, named_callback);
1139 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); 1187 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback);
1140 1188
1141 if (data.IsEmpty()) data = v8::Undefined(); 1189 if (data.IsEmpty()) data = v8::Undefined();
1142 info->set_data(*Utils::OpenHandle(*data)); 1190 info->set_data(*Utils::OpenHandle(*data));
1143 1191
1144 i::FunctionTemplateInfo* constructor = 1192 i::FunctionTemplateInfo* constructor =
1145 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1193 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1146 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1194 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1147 cons->set_access_check_info(*info); 1195 cons->set_access_check_info(*info);
1148 cons->set_needs_access_check(turned_on_by_default); 1196 cons->set_needs_access_check(turned_on_by_default);
1149 } 1197 }
1150 1198
1151 1199
1152 void ObjectTemplate::SetIndexedPropertyHandler( 1200 void ObjectTemplate::SetIndexedPropertyHandler(
1153 IndexedPropertyGetter getter, 1201 IndexedPropertyGetter getter,
1154 IndexedPropertySetter setter, 1202 IndexedPropertySetter setter,
1155 IndexedPropertyQuery query, 1203 IndexedPropertyQuery query,
1156 IndexedPropertyDeleter remover, 1204 IndexedPropertyDeleter remover,
1157 IndexedPropertyEnumerator enumerator, 1205 IndexedPropertyEnumerator enumerator,
1158 Handle<Value> data) { 1206 Handle<Value> data) {
1159 if (IsDeadCheck("v8::ObjectTemplate::SetIndexedPropertyHandler()")) return; 1207 i::Isolate* isolate = i::Isolate::Current();
1208 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetIndexedPropertyHandler()")) {
1209 return;
1210 }
1160 ENTER_V8; 1211 ENTER_V8;
1161 HandleScope scope; 1212 i::HandleScope scope(isolate);
1162 EnsureConstructor(this); 1213 EnsureConstructor(this);
1163 i::FunctionTemplateInfo* constructor = 1214 i::FunctionTemplateInfo* constructor =
1164 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1215 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1165 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1216 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1166 Utils::ToLocal(cons)->SetIndexedInstancePropertyHandler(getter, 1217 Utils::ToLocal(cons)->SetIndexedInstancePropertyHandler(getter,
1167 setter, 1218 setter,
1168 query, 1219 query,
1169 remover, 1220 remover,
1170 enumerator, 1221 enumerator,
1171 data); 1222 data);
1172 } 1223 }
1173 1224
1174 1225
1175 void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback, 1226 void ObjectTemplate::SetCallAsFunctionHandler(InvocationCallback callback,
1176 Handle<Value> data) { 1227 Handle<Value> data) {
1177 if (IsDeadCheck("v8::ObjectTemplate::SetCallAsFunctionHandler()")) return; 1228 i::Isolate* isolate = i::Isolate::Current();
1229 if (IsDeadCheck(isolate,
1230 "v8::ObjectTemplate::SetCallAsFunctionHandler()")) {
1231 return;
1232 }
1178 ENTER_V8; 1233 ENTER_V8;
1179 HandleScope scope; 1234 i::HandleScope scope(isolate);
1180 EnsureConstructor(this); 1235 EnsureConstructor(this);
1181 i::FunctionTemplateInfo* constructor = 1236 i::FunctionTemplateInfo* constructor =
1182 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); 1237 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
1183 i::Handle<i::FunctionTemplateInfo> cons(constructor); 1238 i::Handle<i::FunctionTemplateInfo> cons(constructor);
1184 Utils::ToLocal(cons)->SetInstanceCallAsFunctionHandler(callback, data); 1239 Utils::ToLocal(cons)->SetInstanceCallAsFunctionHandler(callback, data);
1185 } 1240 }
1186 1241
1187 1242
1188 int ObjectTemplate::InternalFieldCount() { 1243 int ObjectTemplate::InternalFieldCount() {
1189 if (IsDeadCheck("v8::ObjectTemplate::InternalFieldCount()")) { 1244 if (IsDeadCheck(i::Isolate::Current(),
1245 "v8::ObjectTemplate::InternalFieldCount()")) {
1190 return 0; 1246 return 0;
1191 } 1247 }
1192 return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value(); 1248 return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value();
1193 } 1249 }
1194 1250
1195 1251
1196 void ObjectTemplate::SetInternalFieldCount(int value) { 1252 void ObjectTemplate::SetInternalFieldCount(int value) {
1197 if (IsDeadCheck("v8::ObjectTemplate::SetInternalFieldCount()")) return; 1253 i::Isolate* isolate = i::Isolate::Current();
1254 if (IsDeadCheck(isolate, "v8::ObjectTemplate::SetInternalFieldCount()")) {
1255 return;
1256 }
1198 if (!ApiCheck(i::Smi::IsValid(value), 1257 if (!ApiCheck(i::Smi::IsValid(value),
1199 "v8::ObjectTemplate::SetInternalFieldCount()", 1258 "v8::ObjectTemplate::SetInternalFieldCount()",
1200 "Invalid internal field count")) { 1259 "Invalid internal field count")) {
1201 return; 1260 return;
1202 } 1261 }
1203 ENTER_V8; 1262 ENTER_V8;
1204 if (value > 0) { 1263 if (value > 0) {
1205 // The internal field count is set by the constructor function's 1264 // The internal field count is set by the constructor function's
1206 // construct code, so we ensure that there is a constructor 1265 // construct code, so we ensure that there is a constructor
1207 // function to do the setting. 1266 // function to do the setting.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 } 1314 }
1256 1315
1257 1316
1258 // --- S c r i p t --- 1317 // --- S c r i p t ---
1259 1318
1260 1319
1261 Local<Script> Script::New(v8::Handle<String> source, 1320 Local<Script> Script::New(v8::Handle<String> source,
1262 v8::ScriptOrigin* origin, 1321 v8::ScriptOrigin* origin,
1263 v8::ScriptData* pre_data, 1322 v8::ScriptData* pre_data,
1264 v8::Handle<String> script_data) { 1323 v8::Handle<String> script_data) {
1265 ON_BAILOUT("v8::Script::New()", return Local<Script>()); 1324 i::Isolate* isolate = i::Isolate::Current();
1266 LOG_API("Script::New"); 1325 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
1326 LOG_API(isolate, "Script::New");
1267 ENTER_V8; 1327 ENTER_V8;
1268 i::Handle<i::String> str = Utils::OpenHandle(*source); 1328 i::Handle<i::String> str = Utils::OpenHandle(*source);
1269 i::Handle<i::Object> name_obj; 1329 i::Handle<i::Object> name_obj;
1270 int line_offset = 0; 1330 int line_offset = 0;
1271 int column_offset = 0; 1331 int column_offset = 0;
1272 if (origin != NULL) { 1332 if (origin != NULL) {
1273 if (!origin->ResourceName().IsEmpty()) { 1333 if (!origin->ResourceName().IsEmpty()) {
1274 name_obj = Utils::OpenHandle(*origin->ResourceName()); 1334 name_obj = Utils::OpenHandle(*origin->ResourceName());
1275 } 1335 }
1276 if (!origin->ResourceLineOffset().IsEmpty()) { 1336 if (!origin->ResourceLineOffset().IsEmpty()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 v8::Handle<Value> file_name) { 1368 v8::Handle<Value> file_name) {
1309 ScriptOrigin origin(file_name); 1369 ScriptOrigin origin(file_name);
1310 return New(source, &origin); 1370 return New(source, &origin);
1311 } 1371 }
1312 1372
1313 1373
1314 Local<Script> Script::Compile(v8::Handle<String> source, 1374 Local<Script> Script::Compile(v8::Handle<String> source,
1315 v8::ScriptOrigin* origin, 1375 v8::ScriptOrigin* origin,
1316 v8::ScriptData* pre_data, 1376 v8::ScriptData* pre_data,
1317 v8::Handle<String> script_data) { 1377 v8::Handle<String> script_data) {
1318 ON_BAILOUT("v8::Script::Compile()", return Local<Script>()); 1378 i::Isolate* isolate = i::Isolate::Current();
1319 LOG_API("Script::Compile"); 1379 ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>());
1380 LOG_API(isolate, "Script::Compile");
1320 ENTER_V8; 1381 ENTER_V8;
1321 Local<Script> generic = New(source, origin, pre_data, script_data); 1382 Local<Script> generic = New(source, origin, pre_data, script_data);
1322 if (generic.IsEmpty()) 1383 if (generic.IsEmpty())
1323 return generic; 1384 return generic;
1324 i::Handle<i::Object> obj = Utils::OpenHandle(*generic); 1385 i::Handle<i::Object> obj = Utils::OpenHandle(*generic);
1325 i::Handle<i::SharedFunctionInfo> function = 1386 i::Handle<i::SharedFunctionInfo> function =
1326 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); 1387 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj));
1327 i::Handle<i::JSFunction> result = 1388 i::Handle<i::JSFunction> result =
1328 FACTORY->NewFunctionFromSharedFunctionInfo( 1389 FACTORY->NewFunctionFromSharedFunctionInfo(
1329 function, 1390 function,
1330 i::Isolate::Current()->global_context()); 1391 i::Isolate::Current()->global_context());
1331 return Local<Script>(ToApi<Script>(result)); 1392 return Local<Script>(ToApi<Script>(result));
1332 } 1393 }
1333 1394
1334 1395
1335 Local<Script> Script::Compile(v8::Handle<String> source, 1396 Local<Script> Script::Compile(v8::Handle<String> source,
1336 v8::Handle<Value> file_name, 1397 v8::Handle<Value> file_name,
1337 v8::Handle<String> script_data) { 1398 v8::Handle<String> script_data) {
1338 ScriptOrigin origin(file_name); 1399 ScriptOrigin origin(file_name);
1339 return Compile(source, &origin, 0, script_data); 1400 return Compile(source, &origin, 0, script_data);
1340 } 1401 }
1341 1402
1342 1403
1343 Local<Value> Script::Run() { 1404 Local<Value> Script::Run() {
1344 ON_BAILOUT("v8::Script::Run()", return Local<Value>()); 1405 i::Isolate* isolate = i::Isolate::Current();
1345 LOG_API("Script::Run"); 1406 ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
1407 LOG_API(isolate, "Script::Run");
1346 ENTER_V8; 1408 ENTER_V8;
1347 i::Object* raw_result = NULL; 1409 i::Object* raw_result = NULL;
1348 { 1410 {
1349 HandleScope scope; 1411 HandleScope scope;
1350 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1412 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1351 i::Handle<i::JSFunction> fun; 1413 i::Handle<i::JSFunction> fun;
1352 if (obj->IsSharedFunctionInfo()) { 1414 if (obj->IsSharedFunctionInfo()) {
1353 i::Handle<i::SharedFunctionInfo> 1415 i::Handle<i::SharedFunctionInfo>
1354 function_info(i::SharedFunctionInfo::cast(*obj)); 1416 function_info(i::SharedFunctionInfo::cast(*obj));
1355 fun = FACTORY->NewFunctionFromSharedFunctionInfo( 1417 fun = FACTORY->NewFunctionFromSharedFunctionInfo(
(...skipping 22 matching lines...) Expand all
1378 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj)); 1440 i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj));
1379 } else { 1441 } else {
1380 result = 1442 result =
1381 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared()); 1443 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared());
1382 } 1444 }
1383 return result; 1445 return result;
1384 } 1446 }
1385 1447
1386 1448
1387 Local<Value> Script::Id() { 1449 Local<Value> Script::Id() {
1388 ON_BAILOUT("v8::Script::Id()", return Local<Value>()); 1450 i::Isolate* isolate = i::Isolate::Current();
1389 LOG_API("Script::Id"); 1451 ON_BAILOUT(isolate, "v8::Script::Id()", return Local<Value>());
1452 LOG_API(isolate, "Script::Id");
1390 i::Object* raw_id = NULL; 1453 i::Object* raw_id = NULL;
1391 { 1454 {
1392 HandleScope scope; 1455 i::HandleScope scope(isolate);
1393 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); 1456 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
1394 i::Handle<i::Script> script(i::Script::cast(function_info->script())); 1457 i::Handle<i::Script> script(i::Script::cast(function_info->script()));
1395 i::Handle<i::Object> id(script->id()); 1458 i::Handle<i::Object> id(script->id());
1396 raw_id = *id; 1459 raw_id = *id;
1397 } 1460 }
1398 i::Handle<i::Object> id(raw_id); 1461 i::Handle<i::Object> id(raw_id);
1399 return Utils::ToLocal(id); 1462 return Utils::ToLocal(id);
1400 } 1463 }
1401 1464
1402 1465
1403 void Script::SetData(v8::Handle<String> data) { 1466 void Script::SetData(v8::Handle<String> data) {
1404 ON_BAILOUT("v8::Script::SetData()", return); 1467 i::Isolate* isolate = i::Isolate::Current();
1405 LOG_API("Script::SetData"); 1468 ON_BAILOUT(isolate, "v8::Script::SetData()", return);
1469 LOG_API(isolate, "Script::SetData");
1406 { 1470 {
1407 HandleScope scope; 1471 i::HandleScope scope(isolate);
1408 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this); 1472 i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
1409 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data); 1473 i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
1410 i::Handle<i::Script> script(i::Script::cast(function_info->script())); 1474 i::Handle<i::Script> script(i::Script::cast(function_info->script()));
1411 script->set_data(*raw_data); 1475 script->set_data(*raw_data);
1412 } 1476 }
1413 } 1477 }
1414 1478
1415 1479
1416 // --- E x c e p t i o n s --- 1480 // --- E x c e p t i o n s ---
1417 1481
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1571
1508 void v8::TryCatch::SetCaptureMessage(bool value) { 1572 void v8::TryCatch::SetCaptureMessage(bool value) {
1509 capture_message_ = value; 1573 capture_message_ = value;
1510 } 1574 }
1511 1575
1512 1576
1513 // --- M e s s a g e --- 1577 // --- M e s s a g e ---
1514 1578
1515 1579
1516 Local<String> Message::Get() const { 1580 Local<String> Message::Get() const {
1517 ON_BAILOUT("v8::Message::Get()", return Local<String>()); 1581 i::Isolate* isolate = i::Isolate::Current();
1582 ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
1518 ENTER_V8; 1583 ENTER_V8;
1519 HandleScope scope; 1584 HandleScope scope;
1520 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1585 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1521 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj); 1586 i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(obj);
1522 Local<String> result = Utils::ToLocal(raw_result); 1587 Local<String> result = Utils::ToLocal(raw_result);
1523 return scope.Close(result); 1588 return scope.Close(result);
1524 } 1589 }
1525 1590
1526 1591
1527 v8::Handle<Value> Message::GetScriptResourceName() const { 1592 v8::Handle<Value> Message::GetScriptResourceName() const {
1528 if (IsDeadCheck("v8::Message::GetScriptResourceName()")) { 1593 i::Isolate* isolate = i::Isolate::Current();
1594 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceName()")) {
1529 return Local<String>(); 1595 return Local<String>();
1530 } 1596 }
1531 ENTER_V8; 1597 ENTER_V8;
1532 HandleScope scope; 1598 HandleScope scope;
1533 i::Handle<i::JSMessageObject> message = 1599 i::Handle<i::JSMessageObject> message =
1534 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1600 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1535 // Return this.script.name. 1601 // Return this.script.name.
1536 i::Handle<i::JSValue> script = 1602 i::Handle<i::JSValue> script =
1537 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); 1603 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script()));
1538 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name()); 1604 i::Handle<i::Object> resource_name(i::Script::cast(script->value())->name());
1539 return scope.Close(Utils::ToLocal(resource_name)); 1605 return scope.Close(Utils::ToLocal(resource_name));
1540 } 1606 }
1541 1607
1542 1608
1543 v8::Handle<Value> Message::GetScriptData() const { 1609 v8::Handle<Value> Message::GetScriptData() const {
1544 if (IsDeadCheck("v8::Message::GetScriptResourceData()")) { 1610 i::Isolate* isolate = i::Isolate::Current();
1611 if (IsDeadCheck(isolate, "v8::Message::GetScriptResourceData()")) {
1545 return Local<Value>(); 1612 return Local<Value>();
1546 } 1613 }
1547 ENTER_V8; 1614 ENTER_V8;
1548 HandleScope scope; 1615 HandleScope scope;
1549 i::Handle<i::JSMessageObject> message = 1616 i::Handle<i::JSMessageObject> message =
1550 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1617 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1551 // Return this.script.data. 1618 // Return this.script.data.
1552 i::Handle<i::JSValue> script = 1619 i::Handle<i::JSValue> script =
1553 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script())); 1620 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script()));
1554 i::Handle<i::Object> data(i::Script::cast(script->value())->data()); 1621 i::Handle<i::Object> data(i::Script::cast(script->value())->data());
1555 return scope.Close(Utils::ToLocal(data)); 1622 return scope.Close(Utils::ToLocal(data));
1556 } 1623 }
1557 1624
1558 1625
1559 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { 1626 v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
1560 if (IsDeadCheck("v8::Message::GetStackTrace()")) { 1627 i::Isolate* isolate = i::Isolate::Current();
1628 if (IsDeadCheck(isolate, "v8::Message::GetStackTrace()")) {
1561 return Local<v8::StackTrace>(); 1629 return Local<v8::StackTrace>();
1562 } 1630 }
1563 ENTER_V8; 1631 ENTER_V8;
1564 HandleScope scope; 1632 HandleScope scope;
1565 i::Handle<i::JSMessageObject> message = 1633 i::Handle<i::JSMessageObject> message =
1566 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1634 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1567 i::Handle<i::Object> stackFramesObj(message->stack_frames()); 1635 i::Handle<i::Object> stackFramesObj(message->stack_frames());
1568 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); 1636 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
1569 i::Handle<i::JSArray> stackTrace = 1637 i::Handle<i::JSArray> stackTrace =
1570 i::Handle<i::JSArray>::cast(stackFramesObj); 1638 i::Handle<i::JSArray>::cast(stackFramesObj);
(...skipping 24 matching lines...) Expand all
1595 i::Object** argv[1] = { data.location() }; 1663 i::Object** argv[1] = { data.location() };
1596 return CallV8HeapFunction(name, 1664 return CallV8HeapFunction(name,
1597 i::Isolate::Current()->js_builtins_object(), 1665 i::Isolate::Current()->js_builtins_object(),
1598 1, 1666 1,
1599 argv, 1667 argv,
1600 has_pending_exception); 1668 has_pending_exception);
1601 } 1669 }
1602 1670
1603 1671
1604 int Message::GetLineNumber() const { 1672 int Message::GetLineNumber() const {
1605 ON_BAILOUT("v8::Message::GetLineNumber()", return kNoLineNumberInfo); 1673 i::Isolate* isolate = i::Isolate::Current();
1674 ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo);
1606 ENTER_V8; 1675 ENTER_V8;
1607 HandleScope scope; 1676 i::HandleScope scope(isolate);
1608 1677
1609 EXCEPTION_PREAMBLE(); 1678 EXCEPTION_PREAMBLE();
1610 i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber", 1679 i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber",
1611 Utils::OpenHandle(this), 1680 Utils::OpenHandle(this),
1612 &has_pending_exception); 1681 &has_pending_exception);
1613 EXCEPTION_BAILOUT_CHECK(0); 1682 EXCEPTION_BAILOUT_CHECK(0);
1614 return static_cast<int>(result->Number()); 1683 return static_cast<int>(result->Number());
1615 } 1684 }
1616 1685
1617 1686
1618 int Message::GetStartPosition() const { 1687 int Message::GetStartPosition() const {
1619 if (IsDeadCheck("v8::Message::GetStartPosition()")) return 0; 1688 i::Isolate* isolate = i::Isolate::Current();
1689 if (IsDeadCheck(isolate, "v8::Message::GetStartPosition()")) return 0;
1620 ENTER_V8; 1690 ENTER_V8;
1621 HandleScope scope; 1691 i::HandleScope scope(isolate);
1622 i::Handle<i::JSMessageObject> message = 1692 i::Handle<i::JSMessageObject> message =
1623 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1693 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1624 return message->start_position(); 1694 return message->start_position();
1625 } 1695 }
1626 1696
1627 1697
1628 int Message::GetEndPosition() const { 1698 int Message::GetEndPosition() const {
1629 if (IsDeadCheck("v8::Message::GetEndPosition()")) return 0; 1699 i::Isolate* isolate = i::Isolate::Current();
1700 if (IsDeadCheck(isolate, "v8::Message::GetEndPosition()")) return 0;
1630 ENTER_V8; 1701 ENTER_V8;
1631 HandleScope scope; 1702 i::HandleScope scope(isolate);
1632 i::Handle<i::JSMessageObject> message = 1703 i::Handle<i::JSMessageObject> message =
1633 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); 1704 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
1634 return message->end_position(); 1705 return message->end_position();
1635 } 1706 }
1636 1707
1637 1708
1638 int Message::GetStartColumn() const { 1709 int Message::GetStartColumn() const {
1639 if (IsDeadCheck("v8::Message::GetStartColumn()")) return kNoColumnInfo; 1710 i::Isolate* isolate = i::Isolate::Current();
1711 if (IsDeadCheck(isolate, "v8::Message::GetStartColumn()")) {
1712 return kNoColumnInfo;
1713 }
1640 ENTER_V8; 1714 ENTER_V8;
1641 HandleScope scope; 1715 i::HandleScope scope(isolate);
1642 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); 1716 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1643 EXCEPTION_PREAMBLE(); 1717 EXCEPTION_PREAMBLE();
1644 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( 1718 i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
1645 "GetPositionInLine", 1719 "GetPositionInLine",
1646 data_obj, 1720 data_obj,
1647 &has_pending_exception); 1721 &has_pending_exception);
1648 EXCEPTION_BAILOUT_CHECK(0); 1722 EXCEPTION_BAILOUT_CHECK(0);
1649 return static_cast<int>(start_col_obj->Number()); 1723 return static_cast<int>(start_col_obj->Number());
1650 } 1724 }
1651 1725
1652 1726
1653 int Message::GetEndColumn() const { 1727 int Message::GetEndColumn() const {
1654 if (IsDeadCheck("v8::Message::GetEndColumn()")) return kNoColumnInfo; 1728 i::Isolate* isolate = i::Isolate::Current();
1729 if (IsDeadCheck(isolate, "v8::Message::GetEndColumn()")) return kNoColumnInfo;
1655 ENTER_V8; 1730 ENTER_V8;
1656 HandleScope scope; 1731 i::HandleScope scope(isolate);
1657 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); 1732 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this);
1658 EXCEPTION_PREAMBLE(); 1733 EXCEPTION_PREAMBLE();
1659 i::Handle<i::Object> start_col_obj = CallV8HeapFunction( 1734 i::Handle<i::Object> start_col_obj = CallV8HeapFunction(
1660 "GetPositionInLine", 1735 "GetPositionInLine",
1661 data_obj, 1736 data_obj,
1662 &has_pending_exception); 1737 &has_pending_exception);
1663 EXCEPTION_BAILOUT_CHECK(0); 1738 EXCEPTION_BAILOUT_CHECK(0);
1664 i::Handle<i::JSMessageObject> message = 1739 i::Handle<i::JSMessageObject> message =
1665 i::Handle<i::JSMessageObject>::cast(data_obj); 1740 i::Handle<i::JSMessageObject>::cast(data_obj);
1666 int start = message->start_position(); 1741 int start = message->start_position();
1667 int end = message->end_position(); 1742 int end = message->end_position();
1668 return static_cast<int>(start_col_obj->Number()) + (end - start); 1743 return static_cast<int>(start_col_obj->Number()) + (end - start);
1669 } 1744 }
1670 1745
1671 1746
1672 Local<String> Message::GetSourceLine() const { 1747 Local<String> Message::GetSourceLine() const {
1673 ON_BAILOUT("v8::Message::GetSourceLine()", return Local<String>()); 1748 i::Isolate* isolate = i::Isolate::Current();
1749 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>());
1674 ENTER_V8; 1750 ENTER_V8;
1675 HandleScope scope; 1751 HandleScope scope;
1676 EXCEPTION_PREAMBLE(); 1752 EXCEPTION_PREAMBLE();
1677 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", 1753 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
1678 Utils::OpenHandle(this), 1754 Utils::OpenHandle(this),
1679 &has_pending_exception); 1755 &has_pending_exception);
1680 EXCEPTION_BAILOUT_CHECK(Local<v8::String>()); 1756 EXCEPTION_BAILOUT_CHECK(Local<v8::String>());
1681 if (result->IsString()) { 1757 if (result->IsString()) {
1682 return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result))); 1758 return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
1683 } else { 1759 } else {
1684 return Local<String>(); 1760 return Local<String>();
1685 } 1761 }
1686 } 1762 }
1687 1763
1688 1764
1689 void Message::PrintCurrentStackTrace(FILE* out) { 1765 void Message::PrintCurrentStackTrace(FILE* out) {
1690 if (IsDeadCheck("v8::Message::PrintCurrentStackTrace()")) return; 1766 i::Isolate* isolate = i::Isolate::Current();
1767 if (IsDeadCheck(isolate, "v8::Message::PrintCurrentStackTrace()")) return;
1691 ENTER_V8; 1768 ENTER_V8;
1692 i::Isolate::Current()->PrintCurrentStackTrace(out); 1769 isolate->PrintCurrentStackTrace(out);
1693 } 1770 }
1694 1771
1695 1772
1696 // --- S t a c k T r a c e --- 1773 // --- S t a c k T r a c e ---
1697 1774
1698 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { 1775 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
1699 if (IsDeadCheck("v8::StackTrace::GetFrame()")) return Local<StackFrame>(); 1776 i::Isolate* isolate = i::Isolate::Current();
1777 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrame()")) {
1778 return Local<StackFrame>();
1779 }
1700 ENTER_V8; 1780 ENTER_V8;
1701 HandleScope scope; 1781 HandleScope scope;
1702 i::Handle<i::JSArray> self = Utils::OpenHandle(this); 1782 i::Handle<i::JSArray> self = Utils::OpenHandle(this);
1703 i::Object* raw_object = self->GetElementNoExceptionThrown(index); 1783 i::Object* raw_object = self->GetElementNoExceptionThrown(index);
1704 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object)); 1784 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
1705 return scope.Close(Utils::StackFrameToLocal(obj)); 1785 return scope.Close(Utils::StackFrameToLocal(obj));
1706 } 1786 }
1707 1787
1708 1788
1709 int StackTrace::GetFrameCount() const { 1789 int StackTrace::GetFrameCount() const {
1710 if (IsDeadCheck("v8::StackTrace::GetFrameCount()")) return -1; 1790 i::Isolate* isolate = i::Isolate::Current();
1791 if (IsDeadCheck(isolate, "v8::StackTrace::GetFrameCount()")) return -1;
1711 ENTER_V8; 1792 ENTER_V8;
1712 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); 1793 return i::Smi::cast(Utils::OpenHandle(this)->length())->value();
1713 } 1794 }
1714 1795
1715 1796
1716 Local<Array> StackTrace::AsArray() { 1797 Local<Array> StackTrace::AsArray() {
1717 if (IsDeadCheck("v8::StackTrace::AsArray()")) Local<Array>(); 1798 i::Isolate* isolate = i::Isolate::Current();
1799 if (IsDeadCheck(isolate, "v8::StackTrace::AsArray()")) Local<Array>();
1718 ENTER_V8; 1800 ENTER_V8;
1719 return Utils::ToLocal(Utils::OpenHandle(this)); 1801 return Utils::ToLocal(Utils::OpenHandle(this));
1720 } 1802 }
1721 1803
1722 1804
1723 Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, 1805 Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit,
1724 StackTraceOptions options) { 1806 StackTraceOptions options) {
1725 if (IsDeadCheck("v8::StackTrace::CurrentStackTrace()")) Local<StackTrace>(); 1807 i::Isolate* isolate = i::Isolate::Current();
1808 if (IsDeadCheck(isolate, "v8::StackTrace::CurrentStackTrace()")) {
1809 Local<StackTrace>();
1810 }
1726 ENTER_V8; 1811 ENTER_V8;
1727 i::Handle<i::JSArray> stackTrace = 1812 i::Handle<i::JSArray> stackTrace =
1728 i::Isolate::Current()->CaptureCurrentStackTrace(frame_limit, options); 1813 isolate->CaptureCurrentStackTrace(frame_limit, options);
1729 return Utils::StackTraceToLocal(stackTrace); 1814 return Utils::StackTraceToLocal(stackTrace);
1730 } 1815 }
1731 1816
1732 1817
1733 // --- S t a c k F r a m e --- 1818 // --- S t a c k F r a m e ---
1734 1819
1735 int StackFrame::GetLineNumber() const { 1820 int StackFrame::GetLineNumber() const {
1736 if (IsDeadCheck("v8::StackFrame::GetLineNumber()")) { 1821 i::Isolate* isolate = i::Isolate::Current();
1822 if (IsDeadCheck(isolate, "v8::StackFrame::GetLineNumber()")) {
1737 return Message::kNoLineNumberInfo; 1823 return Message::kNoLineNumberInfo;
1738 } 1824 }
1739 ENTER_V8; 1825 ENTER_V8;
1740 i::HandleScope scope; 1826 i::HandleScope scope(isolate);
1741 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1827 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1742 i::Handle<i::Object> line = GetProperty(self, "lineNumber"); 1828 i::Handle<i::Object> line = GetProperty(self, "lineNumber");
1743 if (!line->IsSmi()) { 1829 if (!line->IsSmi()) {
1744 return Message::kNoLineNumberInfo; 1830 return Message::kNoLineNumberInfo;
1745 } 1831 }
1746 return i::Smi::cast(*line)->value(); 1832 return i::Smi::cast(*line)->value();
1747 } 1833 }
1748 1834
1749 1835
1750 int StackFrame::GetColumn() const { 1836 int StackFrame::GetColumn() const {
1751 if (IsDeadCheck("v8::StackFrame::GetColumn()")) { 1837 i::Isolate* isolate = i::Isolate::Current();
1838 if (IsDeadCheck(isolate, "v8::StackFrame::GetColumn()")) {
1752 return Message::kNoColumnInfo; 1839 return Message::kNoColumnInfo;
1753 } 1840 }
1754 ENTER_V8; 1841 ENTER_V8;
1755 i::HandleScope scope; 1842 i::HandleScope scope(isolate);
1756 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1843 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1757 i::Handle<i::Object> column = GetProperty(self, "column"); 1844 i::Handle<i::Object> column = GetProperty(self, "column");
1758 if (!column->IsSmi()) { 1845 if (!column->IsSmi()) {
1759 return Message::kNoColumnInfo; 1846 return Message::kNoColumnInfo;
1760 } 1847 }
1761 return i::Smi::cast(*column)->value(); 1848 return i::Smi::cast(*column)->value();
1762 } 1849 }
1763 1850
1764 1851
1765 Local<String> StackFrame::GetScriptName() const { 1852 Local<String> StackFrame::GetScriptName() const {
1766 if (IsDeadCheck("v8::StackFrame::GetScriptName()")) return Local<String>(); 1853 i::Isolate* isolate = i::Isolate::Current();
1854 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptName()")) {
1855 return Local<String>();
1856 }
1767 ENTER_V8; 1857 ENTER_V8;
1768 HandleScope scope; 1858 HandleScope scope;
1769 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1859 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1770 i::Handle<i::Object> name = GetProperty(self, "scriptName"); 1860 i::Handle<i::Object> name = GetProperty(self, "scriptName");
1771 if (!name->IsString()) { 1861 if (!name->IsString()) {
1772 return Local<String>(); 1862 return Local<String>();
1773 } 1863 }
1774 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 1864 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
1775 } 1865 }
1776 1866
1777 1867
1778 Local<String> StackFrame::GetScriptNameOrSourceURL() const { 1868 Local<String> StackFrame::GetScriptNameOrSourceURL() const {
1779 if (IsDeadCheck("v8::StackFrame::GetScriptNameOrSourceURL()")) { 1869 i::Isolate* isolate = i::Isolate::Current();
1870 if (IsDeadCheck(isolate, "v8::StackFrame::GetScriptNameOrSourceURL()")) {
1780 return Local<String>(); 1871 return Local<String>();
1781 } 1872 }
1782 ENTER_V8; 1873 ENTER_V8;
1783 HandleScope scope; 1874 HandleScope scope;
1784 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1875 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1785 i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL"); 1876 i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL");
1786 if (!name->IsString()) { 1877 if (!name->IsString()) {
1787 return Local<String>(); 1878 return Local<String>();
1788 } 1879 }
1789 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 1880 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
1790 } 1881 }
1791 1882
1792 1883
1793 Local<String> StackFrame::GetFunctionName() const { 1884 Local<String> StackFrame::GetFunctionName() const {
1794 if (IsDeadCheck("v8::StackFrame::GetFunctionName()")) return Local<String>(); 1885 i::Isolate* isolate = i::Isolate::Current();
1886 if (IsDeadCheck(isolate, "v8::StackFrame::GetFunctionName()")) {
1887 return Local<String>();
1888 }
1795 ENTER_V8; 1889 ENTER_V8;
1796 HandleScope scope; 1890 HandleScope scope;
1797 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1891 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1798 i::Handle<i::Object> name = GetProperty(self, "functionName"); 1892 i::Handle<i::Object> name = GetProperty(self, "functionName");
1799 if (!name->IsString()) { 1893 if (!name->IsString()) {
1800 return Local<String>(); 1894 return Local<String>();
1801 } 1895 }
1802 return scope.Close(Local<String>::Cast(Utils::ToLocal(name))); 1896 return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
1803 } 1897 }
1804 1898
1805 1899
1806 bool StackFrame::IsEval() const { 1900 bool StackFrame::IsEval() const {
1807 if (IsDeadCheck("v8::StackFrame::IsEval()")) return false; 1901 i::Isolate* isolate = i::Isolate::Current();
1902 if (IsDeadCheck(isolate, "v8::StackFrame::IsEval()")) return false;
1808 ENTER_V8; 1903 ENTER_V8;
1809 i::HandleScope scope; 1904 i::HandleScope scope(isolate);
1810 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1905 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1811 i::Handle<i::Object> is_eval = GetProperty(self, "isEval"); 1906 i::Handle<i::Object> is_eval = GetProperty(self, "isEval");
1812 return is_eval->IsTrue(); 1907 return is_eval->IsTrue();
1813 } 1908 }
1814 1909
1815 1910
1816 bool StackFrame::IsConstructor() const { 1911 bool StackFrame::IsConstructor() const {
1817 if (IsDeadCheck("v8::StackFrame::IsConstructor()")) return false; 1912 i::Isolate* isolate = i::Isolate::Current();
1913 if (IsDeadCheck(isolate, "v8::StackFrame::IsConstructor()")) return false;
1818 ENTER_V8; 1914 ENTER_V8;
1819 i::HandleScope scope; 1915 i::HandleScope scope(isolate);
1820 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1916 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1821 i::Handle<i::Object> is_constructor = GetProperty(self, "isConstructor"); 1917 i::Handle<i::Object> is_constructor = GetProperty(self, "isConstructor");
1822 return is_constructor->IsTrue(); 1918 return is_constructor->IsTrue();
1823 } 1919 }
1824 1920
1825 1921
1826 // --- D a t a --- 1922 // --- D a t a ---
1827 1923
1828 bool Value::IsUndefined() const { 1924 bool Value::IsUndefined() const {
1829 if (IsDeadCheck("v8::Value::IsUndefined()")) return false; 1925 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUndefined()")) {
1926 return false;
1927 }
1830 return Utils::OpenHandle(this)->IsUndefined(); 1928 return Utils::OpenHandle(this)->IsUndefined();
1831 } 1929 }
1832 1930
1833 1931
1834 bool Value::IsNull() const { 1932 bool Value::IsNull() const {
1835 if (IsDeadCheck("v8::Value::IsNull()")) return false; 1933 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsNull()")) return false;
1836 return Utils::OpenHandle(this)->IsNull(); 1934 return Utils::OpenHandle(this)->IsNull();
1837 } 1935 }
1838 1936
1839 1937
1840 bool Value::IsTrue() const { 1938 bool Value::IsTrue() const {
1841 if (IsDeadCheck("v8::Value::IsTrue()")) return false; 1939 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsTrue()")) return false;
1842 return Utils::OpenHandle(this)->IsTrue(); 1940 return Utils::OpenHandle(this)->IsTrue();
1843 } 1941 }
1844 1942
1845 1943
1846 bool Value::IsFalse() const { 1944 bool Value::IsFalse() const {
1847 if (IsDeadCheck("v8::Value::IsFalse()")) return false; 1945 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsFalse()")) return false;
1848 return Utils::OpenHandle(this)->IsFalse(); 1946 return Utils::OpenHandle(this)->IsFalse();
1849 } 1947 }
1850 1948
1851 1949
1852 bool Value::IsFunction() const { 1950 bool Value::IsFunction() const {
1853 if (IsDeadCheck("v8::Value::IsFunction()")) return false; 1951 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsFunction()")) {
1952 return false;
1953 }
1854 return Utils::OpenHandle(this)->IsJSFunction(); 1954 return Utils::OpenHandle(this)->IsJSFunction();
1855 } 1955 }
1856 1956
1857 1957
1858 bool Value::FullIsString() const { 1958 bool Value::FullIsString() const {
1859 if (IsDeadCheck("v8::Value::IsString()")) return false; 1959 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsString()")) return false;
1860 bool result = Utils::OpenHandle(this)->IsString(); 1960 bool result = Utils::OpenHandle(this)->IsString();
1861 ASSERT_EQ(result, QuickIsString()); 1961 ASSERT_EQ(result, QuickIsString());
1862 return result; 1962 return result;
1863 } 1963 }
1864 1964
1865 1965
1866 bool Value::IsArray() const { 1966 bool Value::IsArray() const {
1867 if (IsDeadCheck("v8::Value::IsArray()")) return false; 1967 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsArray()")) return false;
1868 return Utils::OpenHandle(this)->IsJSArray(); 1968 return Utils::OpenHandle(this)->IsJSArray();
1869 } 1969 }
1870 1970
1871 1971
1872 bool Value::IsObject() const { 1972 bool Value::IsObject() const {
1873 if (IsDeadCheck("v8::Value::IsObject()")) return false; 1973 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsObject()")) return false;
1874 return Utils::OpenHandle(this)->IsJSObject(); 1974 return Utils::OpenHandle(this)->IsJSObject();
1875 } 1975 }
1876 1976
1877 1977
1878 bool Value::IsNumber() const { 1978 bool Value::IsNumber() const {
1879 if (IsDeadCheck("v8::Value::IsNumber()")) return false; 1979 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsNumber()")) return false;
1880 return Utils::OpenHandle(this)->IsNumber(); 1980 return Utils::OpenHandle(this)->IsNumber();
1881 } 1981 }
1882 1982
1883 1983
1884 bool Value::IsBoolean() const { 1984 bool Value::IsBoolean() const {
1885 if (IsDeadCheck("v8::Value::IsBoolean()")) return false; 1985 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsBoolean()")) {
1986 return false;
1987 }
1886 return Utils::OpenHandle(this)->IsBoolean(); 1988 return Utils::OpenHandle(this)->IsBoolean();
1887 } 1989 }
1888 1990
1889 1991
1890 bool Value::IsExternal() const { 1992 bool Value::IsExternal() const {
1891 if (IsDeadCheck("v8::Value::IsExternal()")) return false; 1993 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsExternal()")) {
1994 return false;
1995 }
1892 return Utils::OpenHandle(this)->IsProxy(); 1996 return Utils::OpenHandle(this)->IsProxy();
1893 } 1997 }
1894 1998
1895 1999
1896 bool Value::IsInt32() const { 2000 bool Value::IsInt32() const {
1897 if (IsDeadCheck("v8::Value::IsInt32()")) return false; 2001 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsInt32()")) return false;
1898 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2002 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1899 if (obj->IsSmi()) return true; 2003 if (obj->IsSmi()) return true;
1900 if (obj->IsNumber()) { 2004 if (obj->IsNumber()) {
1901 double value = obj->Number(); 2005 double value = obj->Number();
1902 return i::FastI2D(i::FastD2I(value)) == value; 2006 return i::FastI2D(i::FastD2I(value)) == value;
1903 } 2007 }
1904 return false; 2008 return false;
1905 } 2009 }
1906 2010
1907 2011
1908 bool Value::IsUint32() const { 2012 bool Value::IsUint32() const {
1909 if (IsDeadCheck("v8::Value::IsUint32()")) return false; 2013 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUint32()")) return false;
1910 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2014 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1911 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; 2015 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0;
1912 if (obj->IsNumber()) { 2016 if (obj->IsNumber()) {
1913 double value = obj->Number(); 2017 double value = obj->Number();
1914 return i::FastUI2D(i::FastD2UI(value)) == value; 2018 return i::FastUI2D(i::FastD2UI(value)) == value;
1915 } 2019 }
1916 return false; 2020 return false;
1917 } 2021 }
1918 2022
1919 2023
1920 bool Value::IsDate() const { 2024 bool Value::IsDate() const {
1921 if (IsDeadCheck("v8::Value::IsDate()")) return false; 2025 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsDate()")) return false;
1922 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2026 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1923 return obj->HasSpecificClassOf(HEAP->Date_symbol()); 2027 return obj->HasSpecificClassOf(HEAP->Date_symbol());
1924 } 2028 }
1925 2029
1926 2030
1927 bool Value::IsRegExp() const { 2031 bool Value::IsRegExp() const {
1928 if (IsDeadCheck("v8::Value::IsRegExp()")) return false; 2032 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsRegExp()")) return false;
1929 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2033 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1930 return obj->IsJSRegExp(); 2034 return obj->IsJSRegExp();
1931 } 2035 }
1932 2036
1933 2037
1934 Local<String> Value::ToString() const { 2038 Local<String> Value::ToString() const {
1935 if (IsDeadCheck("v8::Value::ToString()")) return Local<String>(); 2039 i::Isolate* isolate = i::Isolate::Current();
1936 LOG_API("ToString"); 2040 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::ToString()")) {
2041 return Local<String>();
2042 }
2043 LOG_API(isolate, "ToString");
1937 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2044 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1938 i::Handle<i::Object> str; 2045 i::Handle<i::Object> str;
1939 if (obj->IsString()) { 2046 if (obj->IsString()) {
1940 str = obj; 2047 str = obj;
1941 } else { 2048 } else {
1942 ENTER_V8; 2049 ENTER_V8;
1943 EXCEPTION_PREAMBLE(); 2050 EXCEPTION_PREAMBLE();
1944 str = i::Execution::ToString(obj, &has_pending_exception); 2051 str = i::Execution::ToString(obj, &has_pending_exception);
1945 EXCEPTION_BAILOUT_CHECK(Local<String>()); 2052 EXCEPTION_BAILOUT_CHECK(Local<String>());
1946 } 2053 }
1947 return Local<String>(ToApi<String>(str)); 2054 return Local<String>(ToApi<String>(str));
1948 } 2055 }
1949 2056
1950 2057
1951 Local<String> Value::ToDetailString() const { 2058 Local<String> Value::ToDetailString() const {
1952 if (IsDeadCheck("v8::Value::ToDetailString()")) return Local<String>(); 2059 i::Isolate* isolate = i::Isolate::Current();
1953 LOG_API("ToDetailString"); 2060 if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) {
2061 return Local<String>();
2062 }
2063 LOG_API(isolate, "ToDetailString");
1954 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2064 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1955 i::Handle<i::Object> str; 2065 i::Handle<i::Object> str;
1956 if (obj->IsString()) { 2066 if (obj->IsString()) {
1957 str = obj; 2067 str = obj;
1958 } else { 2068 } else {
1959 ENTER_V8; 2069 ENTER_V8;
1960 EXCEPTION_PREAMBLE(); 2070 EXCEPTION_PREAMBLE();
1961 str = i::Execution::ToDetailString(obj, &has_pending_exception); 2071 str = i::Execution::ToDetailString(obj, &has_pending_exception);
1962 EXCEPTION_BAILOUT_CHECK(Local<String>()); 2072 EXCEPTION_BAILOUT_CHECK(Local<String>());
1963 } 2073 }
1964 return Local<String>(ToApi<String>(str)); 2074 return Local<String>(ToApi<String>(str));
1965 } 2075 }
1966 2076
1967 2077
1968 Local<v8::Object> Value::ToObject() const { 2078 Local<v8::Object> Value::ToObject() const {
1969 if (IsDeadCheck("v8::Value::ToObject()")) return Local<v8::Object>(); 2079 i::Isolate* isolate = i::Isolate::Current();
1970 LOG_API("ToObject"); 2080 if (IsDeadCheck(isolate, "v8::Value::ToObject()")) return Local<v8::Object>();
2081 LOG_API(isolate, "ToObject");
1971 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2082 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1972 i::Handle<i::Object> val; 2083 i::Handle<i::Object> val;
1973 if (obj->IsJSObject()) { 2084 if (obj->IsJSObject()) {
1974 val = obj; 2085 val = obj;
1975 } else { 2086 } else {
1976 ENTER_V8; 2087 ENTER_V8;
1977 EXCEPTION_PREAMBLE(); 2088 EXCEPTION_PREAMBLE();
1978 val = i::Execution::ToObject(obj, &has_pending_exception); 2089 val = i::Execution::ToObject(obj, &has_pending_exception);
1979 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>()); 2090 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
1980 } 2091 }
1981 return Local<v8::Object>(ToApi<Object>(val)); 2092 return Local<v8::Object>(ToApi<Object>(val));
1982 } 2093 }
1983 2094
1984 2095
1985 Local<Boolean> Value::ToBoolean() const { 2096 Local<Boolean> Value::ToBoolean() const {
1986 if (IsDeadCheck("v8::Value::ToBoolean()")) return Local<Boolean>(); 2097 i::Isolate* isolate = i::Isolate::Current();
1987 LOG_API("ToBoolean"); 2098 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::ToBoolean()")) {
2099 return Local<Boolean>();
2100 }
2101 LOG_API(isolate, "ToBoolean");
1988 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2102 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1989 if (obj->IsBoolean()) { 2103 if (obj->IsBoolean()) {
1990 return Local<Boolean>(ToApi<Boolean>(obj)); 2104 return Local<Boolean>(ToApi<Boolean>(obj));
1991 } else { 2105 } else {
1992 ENTER_V8; 2106 ENTER_V8;
1993 i::Handle<i::Object> val = i::Execution::ToBoolean(obj); 2107 i::Handle<i::Object> val = i::Execution::ToBoolean(obj);
1994 return Local<Boolean>(ToApi<Boolean>(val)); 2108 return Local<Boolean>(ToApi<Boolean>(val));
1995 } 2109 }
1996 } 2110 }
1997 2111
1998 2112
1999 Local<Number> Value::ToNumber() const { 2113 Local<Number> Value::ToNumber() const {
2000 if (IsDeadCheck("v8::Value::ToNumber()")) return Local<Number>(); 2114 i::Isolate* isolate = i::Isolate::Current();
2001 LOG_API("ToNumber"); 2115 if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) return Local<Number>();
2116 LOG_API(isolate, "ToNumber");
2002 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2117 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2003 i::Handle<i::Object> num; 2118 i::Handle<i::Object> num;
2004 if (obj->IsNumber()) { 2119 if (obj->IsNumber()) {
2005 num = obj; 2120 num = obj;
2006 } else { 2121 } else {
2007 ENTER_V8; 2122 ENTER_V8;
2008 EXCEPTION_PREAMBLE(); 2123 EXCEPTION_PREAMBLE();
2009 num = i::Execution::ToNumber(obj, &has_pending_exception); 2124 num = i::Execution::ToNumber(obj, &has_pending_exception);
2010 EXCEPTION_BAILOUT_CHECK(Local<Number>()); 2125 EXCEPTION_BAILOUT_CHECK(Local<Number>());
2011 } 2126 }
2012 return Local<Number>(ToApi<Number>(num)); 2127 return Local<Number>(ToApi<Number>(num));
2013 } 2128 }
2014 2129
2015 2130
2016 Local<Integer> Value::ToInteger() const { 2131 Local<Integer> Value::ToInteger() const {
2017 if (IsDeadCheck("v8::Value::ToInteger()")) return Local<Integer>(); 2132 i::Isolate* isolate = i::Isolate::Current();
2018 LOG_API("ToInteger"); 2133 if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>();
2134 LOG_API(isolate, "ToInteger");
2019 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2135 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2020 i::Handle<i::Object> num; 2136 i::Handle<i::Object> num;
2021 if (obj->IsSmi()) { 2137 if (obj->IsSmi()) {
2022 num = obj; 2138 num = obj;
2023 } else { 2139 } else {
2024 ENTER_V8; 2140 ENTER_V8;
2025 EXCEPTION_PREAMBLE(); 2141 EXCEPTION_PREAMBLE();
2026 num = i::Execution::ToInteger(obj, &has_pending_exception); 2142 num = i::Execution::ToInteger(obj, &has_pending_exception);
2027 EXCEPTION_BAILOUT_CHECK(Local<Integer>()); 2143 EXCEPTION_BAILOUT_CHECK(Local<Integer>());
2028 } 2144 }
2029 return Local<Integer>(ToApi<Integer>(num)); 2145 return Local<Integer>(ToApi<Integer>(num));
2030 } 2146 }
2031 2147
2032 2148
2033 void External::CheckCast(v8::Value* that) { 2149 void External::CheckCast(v8::Value* that) {
2034 if (IsDeadCheck("v8::External::Cast()")) return; 2150 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Cast()")) return;
2035 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2151 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2036 ApiCheck(obj->IsProxy(), 2152 ApiCheck(obj->IsProxy(),
2037 "v8::External::Cast()", 2153 "v8::External::Cast()",
2038 "Could not convert to external"); 2154 "Could not convert to external");
2039 } 2155 }
2040 2156
2041 2157
2042 void v8::Object::CheckCast(Value* that) { 2158 void v8::Object::CheckCast(Value* that) {
2043 if (IsDeadCheck("v8::Object::Cast()")) return; 2159 if (IsDeadCheck(i::Isolate::Current(), "v8::Object::Cast()")) return;
2044 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2160 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2045 ApiCheck(obj->IsJSObject(), 2161 ApiCheck(obj->IsJSObject(),
2046 "v8::Object::Cast()", 2162 "v8::Object::Cast()",
2047 "Could not convert to object"); 2163 "Could not convert to object");
2048 } 2164 }
2049 2165
2050 2166
2051 void v8::Function::CheckCast(Value* that) { 2167 void v8::Function::CheckCast(Value* that) {
2052 if (IsDeadCheck("v8::Function::Cast()")) return; 2168 if (IsDeadCheck(i::Isolate::Current(), "v8::Function::Cast()")) return;
2053 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2169 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2054 ApiCheck(obj->IsJSFunction(), 2170 ApiCheck(obj->IsJSFunction(),
2055 "v8::Function::Cast()", 2171 "v8::Function::Cast()",
2056 "Could not convert to function"); 2172 "Could not convert to function");
2057 } 2173 }
2058 2174
2059 2175
2060 void v8::String::CheckCast(v8::Value* that) { 2176 void v8::String::CheckCast(v8::Value* that) {
2061 if (IsDeadCheck("v8::String::Cast()")) return; 2177 if (IsDeadCheck(i::Isolate::Current(), "v8::String::Cast()")) return;
2062 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2178 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2063 ApiCheck(obj->IsString(), 2179 ApiCheck(obj->IsString(),
2064 "v8::String::Cast()", 2180 "v8::String::Cast()",
2065 "Could not convert to string"); 2181 "Could not convert to string");
2066 } 2182 }
2067 2183
2068 2184
2069 void v8::Number::CheckCast(v8::Value* that) { 2185 void v8::Number::CheckCast(v8::Value* that) {
2070 if (IsDeadCheck("v8::Number::Cast()")) return; 2186 if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Cast()")) return;
2071 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2187 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2072 ApiCheck(obj->IsNumber(), 2188 ApiCheck(obj->IsNumber(),
2073 "v8::Number::Cast()", 2189 "v8::Number::Cast()",
2074 "Could not convert to number"); 2190 "Could not convert to number");
2075 } 2191 }
2076 2192
2077 2193
2078 void v8::Integer::CheckCast(v8::Value* that) { 2194 void v8::Integer::CheckCast(v8::Value* that) {
2079 if (IsDeadCheck("v8::Integer::Cast()")) return; 2195 if (IsDeadCheck(i::Isolate::Current(), "v8::Integer::Cast()")) return;
2080 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2196 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2081 ApiCheck(obj->IsNumber(), 2197 ApiCheck(obj->IsNumber(),
2082 "v8::Integer::Cast()", 2198 "v8::Integer::Cast()",
2083 "Could not convert to number"); 2199 "Could not convert to number");
2084 } 2200 }
2085 2201
2086 2202
2087 void v8::Array::CheckCast(Value* that) { 2203 void v8::Array::CheckCast(Value* that) {
2088 if (IsDeadCheck("v8::Array::Cast()")) return; 2204 if (IsDeadCheck(i::Isolate::Current(), "v8::Array::Cast()")) return;
2089 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2205 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2090 ApiCheck(obj->IsJSArray(), 2206 ApiCheck(obj->IsJSArray(),
2091 "v8::Array::Cast()", 2207 "v8::Array::Cast()",
2092 "Could not convert to array"); 2208 "Could not convert to array");
2093 } 2209 }
2094 2210
2095 2211
2096 void v8::Date::CheckCast(v8::Value* that) { 2212 void v8::Date::CheckCast(v8::Value* that) {
2097 if (IsDeadCheck("v8::Date::Cast()")) return; 2213 if (IsDeadCheck(i::Isolate::Current(), "v8::Date::Cast()")) return;
2098 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2214 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2099 ApiCheck(obj->HasSpecificClassOf(HEAP->Date_symbol()), 2215 ApiCheck(obj->HasSpecificClassOf(HEAP->Date_symbol()),
2100 "v8::Date::Cast()", 2216 "v8::Date::Cast()",
2101 "Could not convert to date"); 2217 "Could not convert to date");
2102 } 2218 }
2103 2219
2104 2220
2105 void v8::RegExp::CheckCast(v8::Value* that) { 2221 void v8::RegExp::CheckCast(v8::Value* that) {
2106 if (IsDeadCheck("v8::RegExp::Cast()")) return; 2222 if (IsDeadCheck(i::Isolate::Current(), "v8::RegExp::Cast()")) return;
2107 i::Handle<i::Object> obj = Utils::OpenHandle(that); 2223 i::Handle<i::Object> obj = Utils::OpenHandle(that);
2108 ApiCheck(obj->IsJSRegExp(), 2224 ApiCheck(obj->IsJSRegExp(),
2109 "v8::RegExp::Cast()", 2225 "v8::RegExp::Cast()",
2110 "Could not convert to regular expression"); 2226 "Could not convert to regular expression");
2111 } 2227 }
2112 2228
2113 2229
2114 bool Value::BooleanValue() const { 2230 bool Value::BooleanValue() const {
2115 if (IsDeadCheck("v8::Value::BooleanValue()")) return false; 2231 i::Isolate* isolate = i::Isolate::Current();
2116 LOG_API("BooleanValue"); 2232 if (IsDeadCheck(isolate, "v8::Value::BooleanValue()")) return false;
2233 LOG_API(isolate, "BooleanValue");
2117 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2234 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2118 if (obj->IsBoolean()) { 2235 if (obj->IsBoolean()) {
2119 return obj->IsTrue(); 2236 return obj->IsTrue();
2120 } else { 2237 } else {
2121 ENTER_V8; 2238 ENTER_V8;
2122 i::Handle<i::Object> value = i::Execution::ToBoolean(obj); 2239 i::Handle<i::Object> value = i::Execution::ToBoolean(obj);
2123 return value->IsTrue(); 2240 return value->IsTrue();
2124 } 2241 }
2125 } 2242 }
2126 2243
2127 2244
2128 double Value::NumberValue() const { 2245 double Value::NumberValue() const {
2129 if (IsDeadCheck("v8::Value::NumberValue()")) return i::OS::nan_value(); 2246 i::Isolate* isolate = i::Isolate::Current();
2130 LOG_API("NumberValue"); 2247 if (IsDeadCheck(isolate, "v8::Value::NumberValue()")) {
2248 return i::OS::nan_value();
2249 }
2250 LOG_API(isolate, "NumberValue");
2131 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2251 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2132 i::Handle<i::Object> num; 2252 i::Handle<i::Object> num;
2133 if (obj->IsNumber()) { 2253 if (obj->IsNumber()) {
2134 num = obj; 2254 num = obj;
2135 } else { 2255 } else {
2136 ENTER_V8; 2256 ENTER_V8;
2137 EXCEPTION_PREAMBLE(); 2257 EXCEPTION_PREAMBLE();
2138 num = i::Execution::ToNumber(obj, &has_pending_exception); 2258 num = i::Execution::ToNumber(obj, &has_pending_exception);
2139 EXCEPTION_BAILOUT_CHECK(i::OS::nan_value()); 2259 EXCEPTION_BAILOUT_CHECK(i::OS::nan_value());
2140 } 2260 }
2141 return num->Number(); 2261 return num->Number();
2142 } 2262 }
2143 2263
2144 2264
2145 int64_t Value::IntegerValue() const { 2265 int64_t Value::IntegerValue() const {
2146 if (IsDeadCheck("v8::Value::IntegerValue()")) return 0; 2266 i::Isolate* isolate = i::Isolate::Current();
2147 LOG_API("IntegerValue"); 2267 if (IsDeadCheck(isolate, "v8::Value::IntegerValue()")) return 0;
2268 LOG_API(isolate, "IntegerValue");
2148 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2269 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2149 i::Handle<i::Object> num; 2270 i::Handle<i::Object> num;
2150 if (obj->IsNumber()) { 2271 if (obj->IsNumber()) {
2151 num = obj; 2272 num = obj;
2152 } else { 2273 } else {
2153 ENTER_V8; 2274 ENTER_V8;
2154 EXCEPTION_PREAMBLE(); 2275 EXCEPTION_PREAMBLE();
2155 num = i::Execution::ToInteger(obj, &has_pending_exception); 2276 num = i::Execution::ToInteger(obj, &has_pending_exception);
2156 EXCEPTION_BAILOUT_CHECK(0); 2277 EXCEPTION_BAILOUT_CHECK(0);
2157 } 2278 }
2158 if (num->IsSmi()) { 2279 if (num->IsSmi()) {
2159 return i::Smi::cast(*num)->value(); 2280 return i::Smi::cast(*num)->value();
2160 } else { 2281 } else {
2161 return static_cast<int64_t>(num->Number()); 2282 return static_cast<int64_t>(num->Number());
2162 } 2283 }
2163 } 2284 }
2164 2285
2165 2286
2166 Local<Int32> Value::ToInt32() const { 2287 Local<Int32> Value::ToInt32() const {
2167 if (IsDeadCheck("v8::Value::ToInt32()")) return Local<Int32>(); 2288 i::Isolate* isolate = i::Isolate::Current();
2168 LOG_API("ToInt32"); 2289 if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>();
2290 LOG_API(isolate, "ToInt32");
2169 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2291 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2170 i::Handle<i::Object> num; 2292 i::Handle<i::Object> num;
2171 if (obj->IsSmi()) { 2293 if (obj->IsSmi()) {
2172 num = obj; 2294 num = obj;
2173 } else { 2295 } else {
2174 ENTER_V8; 2296 ENTER_V8;
2175 EXCEPTION_PREAMBLE(); 2297 EXCEPTION_PREAMBLE();
2176 num = i::Execution::ToInt32(obj, &has_pending_exception); 2298 num = i::Execution::ToInt32(obj, &has_pending_exception);
2177 EXCEPTION_BAILOUT_CHECK(Local<Int32>()); 2299 EXCEPTION_BAILOUT_CHECK(Local<Int32>());
2178 } 2300 }
2179 return Local<Int32>(ToApi<Int32>(num)); 2301 return Local<Int32>(ToApi<Int32>(num));
2180 } 2302 }
2181 2303
2182 2304
2183 Local<Uint32> Value::ToUint32() const { 2305 Local<Uint32> Value::ToUint32() const {
2184 if (IsDeadCheck("v8::Value::ToUint32()")) return Local<Uint32>(); 2306 i::Isolate* isolate = i::Isolate::Current();
2185 LOG_API("ToUInt32"); 2307 if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>();
2308 LOG_API(isolate, "ToUInt32");
2186 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2309 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2187 i::Handle<i::Object> num; 2310 i::Handle<i::Object> num;
2188 if (obj->IsSmi()) { 2311 if (obj->IsSmi()) {
2189 num = obj; 2312 num = obj;
2190 } else { 2313 } else {
2191 ENTER_V8; 2314 ENTER_V8;
2192 EXCEPTION_PREAMBLE(); 2315 EXCEPTION_PREAMBLE();
2193 num = i::Execution::ToUint32(obj, &has_pending_exception); 2316 num = i::Execution::ToUint32(obj, &has_pending_exception);
2194 EXCEPTION_BAILOUT_CHECK(Local<Uint32>()); 2317 EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
2195 } 2318 }
2196 return Local<Uint32>(ToApi<Uint32>(num)); 2319 return Local<Uint32>(ToApi<Uint32>(num));
2197 } 2320 }
2198 2321
2199 2322
2200 Local<Uint32> Value::ToArrayIndex() const { 2323 Local<Uint32> Value::ToArrayIndex() const {
2201 if (IsDeadCheck("v8::Value::ToArrayIndex()")) return Local<Uint32>(); 2324 i::Isolate* isolate = i::Isolate::Current();
2202 LOG_API("ToArrayIndex"); 2325 if (IsDeadCheck(isolate, "v8::Value::ToArrayIndex()")) return Local<Uint32>();
2326 LOG_API(isolate, "ToArrayIndex");
2203 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2327 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2204 if (obj->IsSmi()) { 2328 if (obj->IsSmi()) {
2205 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); 2329 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj);
2206 return Local<Uint32>(); 2330 return Local<Uint32>();
2207 } 2331 }
2208 ENTER_V8; 2332 ENTER_V8;
2209 EXCEPTION_PREAMBLE(); 2333 EXCEPTION_PREAMBLE();
2210 i::Handle<i::Object> string_obj = 2334 i::Handle<i::Object> string_obj =
2211 i::Execution::ToString(obj, &has_pending_exception); 2335 i::Execution::ToString(obj, &has_pending_exception);
2212 EXCEPTION_BAILOUT_CHECK(Local<Uint32>()); 2336 EXCEPTION_BAILOUT_CHECK(Local<Uint32>());
2213 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); 2337 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj);
2214 uint32_t index; 2338 uint32_t index;
2215 if (str->AsArrayIndex(&index)) { 2339 if (str->AsArrayIndex(&index)) {
2216 i::Handle<i::Object> value; 2340 i::Handle<i::Object> value;
2217 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { 2341 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) {
2218 value = i::Handle<i::Object>(i::Smi::FromInt(index)); 2342 value = i::Handle<i::Object>(i::Smi::FromInt(index));
2219 } else { 2343 } else {
2220 value = FACTORY->NewNumber(index); 2344 value = FACTORY->NewNumber(index);
2221 } 2345 }
2222 return Utils::Uint32ToLocal(value); 2346 return Utils::Uint32ToLocal(value);
2223 } 2347 }
2224 return Local<Uint32>(); 2348 return Local<Uint32>();
2225 } 2349 }
2226 2350
2227 2351
2228 int32_t Value::Int32Value() const { 2352 int32_t Value::Int32Value() const {
2229 if (IsDeadCheck("v8::Value::Int32Value()")) return 0; 2353 i::Isolate* isolate = i::Isolate::Current();
2230 LOG_API("Int32Value"); 2354 if (IsDeadCheck(isolate, "v8::Value::Int32Value()")) return 0;
2355 LOG_API(isolate, "Int32Value");
2231 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2356 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2232 if (obj->IsSmi()) { 2357 if (obj->IsSmi()) {
2233 return i::Smi::cast(*obj)->value(); 2358 return i::Smi::cast(*obj)->value();
2234 } else { 2359 } else {
2235 LOG_API("Int32Value (slow)"); 2360 LOG_API(isolate, "Int32Value (slow)");
2236 ENTER_V8; 2361 ENTER_V8;
2237 EXCEPTION_PREAMBLE(); 2362 EXCEPTION_PREAMBLE();
2238 i::Handle<i::Object> num = 2363 i::Handle<i::Object> num =
2239 i::Execution::ToInt32(obj, &has_pending_exception); 2364 i::Execution::ToInt32(obj, &has_pending_exception);
2240 EXCEPTION_BAILOUT_CHECK(0); 2365 EXCEPTION_BAILOUT_CHECK(0);
2241 if (num->IsSmi()) { 2366 if (num->IsSmi()) {
2242 return i::Smi::cast(*num)->value(); 2367 return i::Smi::cast(*num)->value();
2243 } else { 2368 } else {
2244 return static_cast<int32_t>(num->Number()); 2369 return static_cast<int32_t>(num->Number());
2245 } 2370 }
2246 } 2371 }
2247 } 2372 }
2248 2373
2249 2374
2250 bool Value::Equals(Handle<Value> that) const { 2375 bool Value::Equals(Handle<Value> that) const {
2251 if (IsDeadCheck("v8::Value::Equals()") 2376 i::Isolate* isolate = i::Isolate::Current();
2377 if (IsDeadCheck(isolate, "v8::Value::Equals()")
2252 || EmptyCheck("v8::Value::Equals()", this) 2378 || EmptyCheck("v8::Value::Equals()", this)
2253 || EmptyCheck("v8::Value::Equals()", that)) { 2379 || EmptyCheck("v8::Value::Equals()", that)) {
2254 return false; 2380 return false;
2255 } 2381 }
2256 LOG_API("Equals"); 2382 LOG_API(isolate, "Equals");
2257 ENTER_V8; 2383 ENTER_V8;
2258 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2384 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2259 i::Handle<i::Object> other = Utils::OpenHandle(*that); 2385 i::Handle<i::Object> other = Utils::OpenHandle(*that);
2260 // If both obj and other are JSObjects, we'd better compare by identity 2386 // If both obj and other are JSObjects, we'd better compare by identity
2261 // immediately when going into JS builtin. The reason is Invoke 2387 // immediately when going into JS builtin. The reason is Invoke
2262 // would overwrite global object receiver with global proxy. 2388 // would overwrite global object receiver with global proxy.
2263 if (obj->IsJSObject() && other->IsJSObject()) { 2389 if (obj->IsJSObject() && other->IsJSObject()) {
2264 return *obj == *other; 2390 return *obj == *other;
2265 } 2391 }
2266 i::Object** args[1] = { other.location() }; 2392 i::Object** args[1] = { other.location() };
2267 EXCEPTION_PREAMBLE(); 2393 EXCEPTION_PREAMBLE();
2268 i::Handle<i::Object> result = 2394 i::Handle<i::Object> result =
2269 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception); 2395 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception);
2270 EXCEPTION_BAILOUT_CHECK(false); 2396 EXCEPTION_BAILOUT_CHECK(false);
2271 return *result == i::Smi::FromInt(i::EQUAL); 2397 return *result == i::Smi::FromInt(i::EQUAL);
2272 } 2398 }
2273 2399
2274 2400
2275 bool Value::StrictEquals(Handle<Value> that) const { 2401 bool Value::StrictEquals(Handle<Value> that) const {
2276 if (IsDeadCheck("v8::Value::StrictEquals()") 2402 i::Isolate* isolate = i::Isolate::Current();
2403 if (IsDeadCheck(isolate, "v8::Value::StrictEquals()")
2277 || EmptyCheck("v8::Value::StrictEquals()", this) 2404 || EmptyCheck("v8::Value::StrictEquals()", this)
2278 || EmptyCheck("v8::Value::StrictEquals()", that)) { 2405 || EmptyCheck("v8::Value::StrictEquals()", that)) {
2279 return false; 2406 return false;
2280 } 2407 }
2281 LOG_API("StrictEquals"); 2408 LOG_API(isolate, "StrictEquals");
2282 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2409 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2283 i::Handle<i::Object> other = Utils::OpenHandle(*that); 2410 i::Handle<i::Object> other = Utils::OpenHandle(*that);
2284 // Must check HeapNumber first, since NaN !== NaN. 2411 // Must check HeapNumber first, since NaN !== NaN.
2285 if (obj->IsHeapNumber()) { 2412 if (obj->IsHeapNumber()) {
2286 if (!other->IsNumber()) return false; 2413 if (!other->IsNumber()) return false;
2287 double x = obj->Number(); 2414 double x = obj->Number();
2288 double y = other->Number(); 2415 double y = other->Number();
2289 // Must check explicitly for NaN:s on Windows, but -0 works fine. 2416 // Must check explicitly for NaN:s on Windows, but -0 works fine.
2290 return x == y && !isnan(x) && !isnan(y); 2417 return x == y && !isnan(x) && !isnan(y);
2291 } else if (*obj == *other) { // Also covers Booleans. 2418 } else if (*obj == *other) { // Also covers Booleans.
2292 return true; 2419 return true;
2293 } else if (obj->IsSmi()) { 2420 } else if (obj->IsSmi()) {
2294 return other->IsNumber() && obj->Number() == other->Number(); 2421 return other->IsNumber() && obj->Number() == other->Number();
2295 } else if (obj->IsString()) { 2422 } else if (obj->IsString()) {
2296 return other->IsString() && 2423 return other->IsString() &&
2297 i::String::cast(*obj)->Equals(i::String::cast(*other)); 2424 i::String::cast(*obj)->Equals(i::String::cast(*other));
2298 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) { 2425 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
2299 return other->IsUndefined() || other->IsUndetectableObject(); 2426 return other->IsUndefined() || other->IsUndetectableObject();
2300 } else { 2427 } else {
2301 return false; 2428 return false;
2302 } 2429 }
2303 } 2430 }
2304 2431
2305 2432
2306 uint32_t Value::Uint32Value() const { 2433 uint32_t Value::Uint32Value() const {
2307 if (IsDeadCheck("v8::Value::Uint32Value()")) return 0; 2434 i::Isolate* isolate = i::Isolate::Current();
2308 LOG_API("Uint32Value"); 2435 if (IsDeadCheck(isolate, "v8::Value::Uint32Value()")) return 0;
2436 LOG_API(isolate, "Uint32Value");
2309 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2437 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2310 if (obj->IsSmi()) { 2438 if (obj->IsSmi()) {
2311 return i::Smi::cast(*obj)->value(); 2439 return i::Smi::cast(*obj)->value();
2312 } else { 2440 } else {
2313 ENTER_V8; 2441 ENTER_V8;
2314 EXCEPTION_PREAMBLE(); 2442 EXCEPTION_PREAMBLE();
2315 i::Handle<i::Object> num = 2443 i::Handle<i::Object> num =
2316 i::Execution::ToUint32(obj, &has_pending_exception); 2444 i::Execution::ToUint32(obj, &has_pending_exception);
2317 EXCEPTION_BAILOUT_CHECK(0); 2445 EXCEPTION_BAILOUT_CHECK(0);
2318 if (num->IsSmi()) { 2446 if (num->IsSmi()) {
2319 return i::Smi::cast(*num)->value(); 2447 return i::Smi::cast(*num)->value();
2320 } else { 2448 } else {
2321 return static_cast<uint32_t>(num->Number()); 2449 return static_cast<uint32_t>(num->Number());
2322 } 2450 }
2323 } 2451 }
2324 } 2452 }
2325 2453
2326 2454
2327 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value, 2455 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
2328 v8::PropertyAttribute attribs) { 2456 v8::PropertyAttribute attribs) {
2329 ON_BAILOUT("v8::Object::Set()", return false); 2457 i::Isolate* isolate = i::Isolate::Current();
2458 ON_BAILOUT(isolate, "v8::Object::Set()", return false);
2330 ENTER_V8; 2459 ENTER_V8;
2331 HandleScope scope; 2460 i::HandleScope scope(isolate);
2332 i::Handle<i::Object> self = Utils::OpenHandle(this); 2461 i::Handle<i::Object> self = Utils::OpenHandle(this);
2333 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2462 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2334 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2463 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2335 EXCEPTION_PREAMBLE(); 2464 EXCEPTION_PREAMBLE();
2336 i::Handle<i::Object> obj = i::SetProperty( 2465 i::Handle<i::Object> obj = i::SetProperty(
2337 self, 2466 self,
2338 key_obj, 2467 key_obj,
2339 value_obj, 2468 value_obj,
2340 static_cast<PropertyAttributes>(attribs), 2469 static_cast<PropertyAttributes>(attribs),
2341 i::kNonStrictMode); 2470 i::kNonStrictMode);
2342 has_pending_exception = obj.is_null(); 2471 has_pending_exception = obj.is_null();
2343 EXCEPTION_BAILOUT_CHECK(false); 2472 EXCEPTION_BAILOUT_CHECK(false);
2344 return true; 2473 return true;
2345 } 2474 }
2346 2475
2347 2476
2348 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { 2477 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
2349 ON_BAILOUT("v8::Object::Set()", return false); 2478 i::Isolate* isolate = i::Isolate::Current();
2479 ON_BAILOUT(isolate, "v8::Object::Set()", return false);
2350 ENTER_V8; 2480 ENTER_V8;
2351 HandleScope scope; 2481 i::HandleScope scope(isolate);
2352 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2482 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2353 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2483 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2354 EXCEPTION_PREAMBLE(); 2484 EXCEPTION_PREAMBLE();
2355 i::Handle<i::Object> obj = i::SetElement( 2485 i::Handle<i::Object> obj = i::SetElement(
2356 self, 2486 self,
2357 index, 2487 index,
2358 value_obj, 2488 value_obj,
2359 i::kNonStrictMode); 2489 i::kNonStrictMode);
2360 has_pending_exception = obj.is_null(); 2490 has_pending_exception = obj.is_null();
2361 EXCEPTION_BAILOUT_CHECK(false); 2491 EXCEPTION_BAILOUT_CHECK(false);
2362 return true; 2492 return true;
2363 } 2493 }
2364 2494
2365 2495
2366 bool v8::Object::ForceSet(v8::Handle<Value> key, 2496 bool v8::Object::ForceSet(v8::Handle<Value> key,
2367 v8::Handle<Value> value, 2497 v8::Handle<Value> value,
2368 v8::PropertyAttribute attribs) { 2498 v8::PropertyAttribute attribs) {
2369 ON_BAILOUT("v8::Object::ForceSet()", return false); 2499 i::Isolate* isolate = i::Isolate::Current();
2500 ON_BAILOUT(isolate, "v8::Object::ForceSet()", return false);
2370 ENTER_V8; 2501 ENTER_V8;
2371 HandleScope scope; 2502 i::HandleScope scope(isolate);
2372 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2503 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2373 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2504 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2374 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2505 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2375 EXCEPTION_PREAMBLE(); 2506 EXCEPTION_PREAMBLE();
2376 i::Handle<i::Object> obj = i::ForceSetProperty( 2507 i::Handle<i::Object> obj = i::ForceSetProperty(
2377 self, 2508 self,
2378 key_obj, 2509 key_obj,
2379 value_obj, 2510 value_obj,
2380 static_cast<PropertyAttributes>(attribs)); 2511 static_cast<PropertyAttributes>(attribs));
2381 has_pending_exception = obj.is_null(); 2512 has_pending_exception = obj.is_null();
2382 EXCEPTION_BAILOUT_CHECK(false); 2513 EXCEPTION_BAILOUT_CHECK(false);
2383 return true; 2514 return true;
2384 } 2515 }
2385 2516
2386 2517
2387 bool v8::Object::ForceDelete(v8::Handle<Value> key) { 2518 bool v8::Object::ForceDelete(v8::Handle<Value> key) {
2388 ON_BAILOUT("v8::Object::ForceDelete()", return false); 2519 i::Isolate* isolate = i::Isolate::Current();
2520 ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false);
2389 ENTER_V8; 2521 ENTER_V8;
2390 HandleScope scope; 2522 i::HandleScope scope(isolate);
2391 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2523 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2392 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2524 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2393 2525
2394 // When turning on access checks for a global object deoptimize all functions 2526 // When turning on access checks for a global object deoptimize all functions
2395 // as optimized code does not always handle access checks. 2527 // as optimized code does not always handle access checks.
2396 i::Deoptimizer::DeoptimizeGlobalObject(*self); 2528 i::Deoptimizer::DeoptimizeGlobalObject(*self);
2397 2529
2398 EXCEPTION_PREAMBLE(); 2530 EXCEPTION_PREAMBLE();
2399 i::Handle<i::Object> obj = i::ForceDeleteProperty(self, key_obj); 2531 i::Handle<i::Object> obj = i::ForceDeleteProperty(self, key_obj);
2400 has_pending_exception = obj.is_null(); 2532 has_pending_exception = obj.is_null();
2401 EXCEPTION_BAILOUT_CHECK(false); 2533 EXCEPTION_BAILOUT_CHECK(false);
2402 return obj->IsTrue(); 2534 return obj->IsTrue();
2403 } 2535 }
2404 2536
2405 2537
2406 Local<Value> v8::Object::Get(v8::Handle<Value> key) { 2538 Local<Value> v8::Object::Get(v8::Handle<Value> key) {
2407 ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>()); 2539 i::Isolate* isolate = i::Isolate::Current();
2540 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
2408 ENTER_V8; 2541 ENTER_V8;
2409 i::Handle<i::Object> self = Utils::OpenHandle(this); 2542 i::Handle<i::Object> self = Utils::OpenHandle(this);
2410 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2543 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2411 EXCEPTION_PREAMBLE(); 2544 EXCEPTION_PREAMBLE();
2412 i::Handle<i::Object> result = i::GetProperty(self, key_obj); 2545 i::Handle<i::Object> result = i::GetProperty(self, key_obj);
2413 has_pending_exception = result.is_null(); 2546 has_pending_exception = result.is_null();
2414 EXCEPTION_BAILOUT_CHECK(Local<Value>()); 2547 EXCEPTION_BAILOUT_CHECK(Local<Value>());
2415 return Utils::ToLocal(result); 2548 return Utils::ToLocal(result);
2416 } 2549 }
2417 2550
2418 2551
2419 Local<Value> v8::Object::Get(uint32_t index) { 2552 Local<Value> v8::Object::Get(uint32_t index) {
2420 ON_BAILOUT("v8::Object::Get()", return Local<v8::Value>()); 2553 i::Isolate* isolate = i::Isolate::Current();
2554 ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
2421 ENTER_V8; 2555 ENTER_V8;
2422 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2556 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2423 EXCEPTION_PREAMBLE(); 2557 EXCEPTION_PREAMBLE();
2424 i::Handle<i::Object> result = i::GetElement(self, index); 2558 i::Handle<i::Object> result = i::GetElement(self, index);
2425 has_pending_exception = result.is_null(); 2559 has_pending_exception = result.is_null();
2426 EXCEPTION_BAILOUT_CHECK(Local<Value>()); 2560 EXCEPTION_BAILOUT_CHECK(Local<Value>());
2427 return Utils::ToLocal(result); 2561 return Utils::ToLocal(result);
2428 } 2562 }
2429 2563
2430 2564
2431 Local<Value> v8::Object::GetPrototype() { 2565 Local<Value> v8::Object::GetPrototype() {
2432 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>()); 2566 ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetPrototype()",
2567 return Local<v8::Value>());
2433 ENTER_V8; 2568 ENTER_V8;
2434 i::Handle<i::Object> self = Utils::OpenHandle(this); 2569 i::Handle<i::Object> self = Utils::OpenHandle(this);
2435 i::Handle<i::Object> result = i::GetPrototype(self); 2570 i::Handle<i::Object> result = i::GetPrototype(self);
2436 return Utils::ToLocal(result); 2571 return Utils::ToLocal(result);
2437 } 2572 }
2438 2573
2439 2574
2440 bool v8::Object::SetPrototype(Handle<Value> value) { 2575 bool v8::Object::SetPrototype(Handle<Value> value) {
2441 ON_BAILOUT("v8::Object::SetPrototype()", return false); 2576 i::Isolate* isolate = i::Isolate::Current();
2577 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
2442 ENTER_V8; 2578 ENTER_V8;
2443 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2579 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2444 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2580 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2445 EXCEPTION_PREAMBLE(); 2581 EXCEPTION_PREAMBLE();
2446 i::Handle<i::Object> result = i::SetPrototype(self, value_obj); 2582 i::Handle<i::Object> result = i::SetPrototype(self, value_obj);
2447 has_pending_exception = result.is_null(); 2583 has_pending_exception = result.is_null();
2448 EXCEPTION_BAILOUT_CHECK(false); 2584 EXCEPTION_BAILOUT_CHECK(false);
2449 return true; 2585 return true;
2450 } 2586 }
2451 2587
2452 2588
2453 Local<Object> v8::Object::FindInstanceInPrototypeChain( 2589 Local<Object> v8::Object::FindInstanceInPrototypeChain(
2454 v8::Handle<FunctionTemplate> tmpl) { 2590 v8::Handle<FunctionTemplate> tmpl) {
2455 ON_BAILOUT("v8::Object::FindInstanceInPrototypeChain()", 2591 ON_BAILOUT(i::Isolate::Current(),
2592 "v8::Object::FindInstanceInPrototypeChain()",
2456 return Local<v8::Object>()); 2593 return Local<v8::Object>());
2457 ENTER_V8; 2594 ENTER_V8;
2458 i::JSObject* object = *Utils::OpenHandle(this); 2595 i::JSObject* object = *Utils::OpenHandle(this);
2459 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); 2596 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
2460 while (!object->IsInstanceOf(tmpl_info)) { 2597 while (!object->IsInstanceOf(tmpl_info)) {
2461 i::Object* prototype = object->GetPrototype(); 2598 i::Object* prototype = object->GetPrototype();
2462 if (!prototype->IsJSObject()) return Local<Object>(); 2599 if (!prototype->IsJSObject()) return Local<Object>();
2463 object = i::JSObject::cast(prototype); 2600 object = i::JSObject::cast(prototype);
2464 } 2601 }
2465 return Utils::ToLocal(i::Handle<i::JSObject>(object)); 2602 return Utils::ToLocal(i::Handle<i::JSObject>(object));
2466 } 2603 }
2467 2604
2468 2605
2469 Local<Array> v8::Object::GetPropertyNames() { 2606 Local<Array> v8::Object::GetPropertyNames() {
2470 ON_BAILOUT("v8::Object::GetPropertyNames()", return Local<v8::Array>()); 2607 ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetPropertyNames()",
2608 return Local<v8::Array>());
2471 ENTER_V8; 2609 ENTER_V8;
2472 v8::HandleScope scope; 2610 v8::HandleScope scope;
2473 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2611 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2474 i::Handle<i::FixedArray> value = 2612 i::Handle<i::FixedArray> value =
2475 i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS); 2613 i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS);
2476 // Because we use caching to speed up enumeration it is important 2614 // Because we use caching to speed up enumeration it is important
2477 // to never change the result of the basic enumeration function so 2615 // to never change the result of the basic enumeration function so
2478 // we clone the result. 2616 // we clone the result.
2479 i::Handle<i::FixedArray> elms = FACTORY->CopyFixedArray(value); 2617 i::Handle<i::FixedArray> elms = FACTORY->CopyFixedArray(value);
2480 i::Handle<i::JSArray> result = FACTORY->NewJSArrayWithElements(elms); 2618 i::Handle<i::JSArray> result = FACTORY->NewJSArrayWithElements(elms);
2481 return scope.Close(Utils::ToLocal(result)); 2619 return scope.Close(Utils::ToLocal(result));
2482 } 2620 }
2483 2621
2484 2622
2485 Local<String> v8::Object::ObjectProtoToString() { 2623 Local<String> v8::Object::ObjectProtoToString() {
2486 ON_BAILOUT("v8::Object::ObjectProtoToString()", return Local<v8::String>()); 2624 ON_BAILOUT(i::Isolate::Current(), "v8::Object::ObjectProtoToString()",
2625 return Local<v8::String>());
2487 ENTER_V8; 2626 ENTER_V8;
2488 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2627 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2489 2628
2490 i::Handle<i::Object> name(self->class_name()); 2629 i::Handle<i::Object> name(self->class_name());
2491 2630
2492 // Native implementation of Object.prototype.toString (v8natives.js): 2631 // Native implementation of Object.prototype.toString (v8natives.js):
2493 // var c = %ClassOf(this); 2632 // var c = %ClassOf(this);
2494 // if (c === 'Arguments') c = 'Object'; 2633 // if (c === 'Arguments') c = 'Object';
2495 // return "[object " + c + "]"; 2634 // return "[object " + c + "]";
2496 2635
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 2667
2529 // Copy the buffer into a heap-allocated string and return it. 2668 // Copy the buffer into a heap-allocated string and return it.
2530 Local<String> result = v8::String::New(buf.start(), buf_len); 2669 Local<String> result = v8::String::New(buf.start(), buf_len);
2531 return result; 2670 return result;
2532 } 2671 }
2533 } 2672 }
2534 } 2673 }
2535 2674
2536 2675
2537 Local<String> v8::Object::GetConstructorName() { 2676 Local<String> v8::Object::GetConstructorName() {
2538 ON_BAILOUT("v8::Object::GetConstructorName()", return Local<v8::String>()); 2677 i::Isolate* isolate = i::Isolate::Current();
2678 ON_BAILOUT(isolate, "v8::Object::GetConstructorName()",
2679 return Local<v8::String>());
2539 ENTER_V8; 2680 ENTER_V8;
2540 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2681 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2541 i::Handle<i::String> name(self->constructor_name()); 2682 i::Handle<i::String> name(self->constructor_name());
2542 return Utils::ToLocal(name); 2683 return Utils::ToLocal(name);
2543 } 2684 }
2544 2685
2545 2686
2546 bool v8::Object::Delete(v8::Handle<String> key) { 2687 bool v8::Object::Delete(v8::Handle<String> key) {
2547 ON_BAILOUT("v8::Object::Delete()", return false); 2688 i::Isolate* isolate = i::Isolate::Current();
2689 ON_BAILOUT(isolate, "v8::Object::Delete()", return false);
2548 ENTER_V8; 2690 ENTER_V8;
2549 HandleScope scope; 2691 i::HandleScope scope(isolate);
2550 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2692 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2551 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2693 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2552 return i::DeleteProperty(self, key_obj)->IsTrue(); 2694 return i::DeleteProperty(self, key_obj)->IsTrue();
2553 } 2695 }
2554 2696
2555 2697
2556 bool v8::Object::Has(v8::Handle<String> key) { 2698 bool v8::Object::Has(v8::Handle<String> key) {
2557 ON_BAILOUT("v8::Object::Has()", return false); 2699 ON_BAILOUT(i::Isolate::Current(), "v8::Object::Has()", return false);
2558 ENTER_V8; 2700 ENTER_V8;
2559 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2701 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2560 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2702 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2561 return self->HasProperty(*key_obj); 2703 return self->HasProperty(*key_obj);
2562 } 2704 }
2563 2705
2564 2706
2565 bool v8::Object::Delete(uint32_t index) { 2707 bool v8::Object::Delete(uint32_t index) {
2566 ON_BAILOUT("v8::Object::DeleteProperty()", return false); 2708 ON_BAILOUT(i::Isolate::Current(), "v8::Object::DeleteProperty()",
2709 return false);
2567 ENTER_V8; 2710 ENTER_V8;
2568 HandleScope scope; 2711 HandleScope scope;
2569 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2712 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2570 return i::DeleteElement(self, index)->IsTrue(); 2713 return i::DeleteElement(self, index)->IsTrue();
2571 } 2714 }
2572 2715
2573 2716
2574 bool v8::Object::Has(uint32_t index) { 2717 bool v8::Object::Has(uint32_t index) {
2575 ON_BAILOUT("v8::Object::HasProperty()", return false); 2718 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasProperty()", return false);
2576 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2719 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2577 return self->HasElement(index); 2720 return self->HasElement(index);
2578 } 2721 }
2579 2722
2580 2723
2581 bool Object::SetAccessor(Handle<String> name, 2724 bool Object::SetAccessor(Handle<String> name,
2582 AccessorGetter getter, 2725 AccessorGetter getter,
2583 AccessorSetter setter, 2726 AccessorSetter setter,
2584 v8::Handle<Value> data, 2727 v8::Handle<Value> data,
2585 AccessControl settings, 2728 AccessControl settings,
2586 PropertyAttribute attributes) { 2729 PropertyAttribute attributes) {
2587 ON_BAILOUT("v8::Object::SetAccessor()", return false); 2730 i::Isolate* isolate = i::Isolate::Current();
2731 ON_BAILOUT(isolate, "v8::Object::SetAccessor()", return false);
2588 ENTER_V8; 2732 ENTER_V8;
2589 HandleScope scope; 2733 i::HandleScope scope(isolate);
2590 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name, 2734 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name,
2591 getter, setter, data, 2735 getter, setter, data,
2592 settings, attributes); 2736 settings, attributes);
2593 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this), info); 2737 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this), info);
2594 return !result.is_null() && !result->IsUndefined(); 2738 return !result.is_null() && !result->IsUndefined();
2595 } 2739 }
2596 2740
2597 2741
2598 bool v8::Object::HasRealNamedProperty(Handle<String> key) { 2742 bool v8::Object::HasRealNamedProperty(Handle<String> key) {
2599 ON_BAILOUT("v8::Object::HasRealNamedProperty()", return false); 2743 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasRealNamedProperty()",
2744 return false);
2600 return Utils::OpenHandle(this)->HasRealNamedProperty( 2745 return Utils::OpenHandle(this)->HasRealNamedProperty(
2601 *Utils::OpenHandle(*key)); 2746 *Utils::OpenHandle(*key));
2602 } 2747 }
2603 2748
2604 2749
2605 bool v8::Object::HasRealIndexedProperty(uint32_t index) { 2750 bool v8::Object::HasRealIndexedProperty(uint32_t index) {
2606 ON_BAILOUT("v8::Object::HasRealIndexedProperty()", return false); 2751 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasRealIndexedProperty()",
2752 return false);
2607 return Utils::OpenHandle(this)->HasRealElementProperty(index); 2753 return Utils::OpenHandle(this)->HasRealElementProperty(index);
2608 } 2754 }
2609 2755
2610 2756
2611 bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) { 2757 bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) {
2612 ON_BAILOUT("v8::Object::HasRealNamedCallbackProperty()", return false); 2758 ON_BAILOUT(i::Isolate::Current(),
2759 "v8::Object::HasRealNamedCallbackProperty()",
2760 return false);
2613 ENTER_V8; 2761 ENTER_V8;
2614 return Utils::OpenHandle(this)->HasRealNamedCallbackProperty( 2762 return Utils::OpenHandle(this)->HasRealNamedCallbackProperty(
2615 *Utils::OpenHandle(*key)); 2763 *Utils::OpenHandle(*key));
2616 } 2764 }
2617 2765
2618 2766
2619 bool v8::Object::HasNamedLookupInterceptor() { 2767 bool v8::Object::HasNamedLookupInterceptor() {
2620 ON_BAILOUT("v8::Object::HasNamedLookupInterceptor()", return false); 2768 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasNamedLookupInterceptor()",
2769 return false);
2621 return Utils::OpenHandle(this)->HasNamedInterceptor(); 2770 return Utils::OpenHandle(this)->HasNamedInterceptor();
2622 } 2771 }
2623 2772
2624 2773
2625 bool v8::Object::HasIndexedLookupInterceptor() { 2774 bool v8::Object::HasIndexedLookupInterceptor() {
2626 ON_BAILOUT("v8::Object::HasIndexedLookupInterceptor()", return false); 2775 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasIndexedLookupInterceptor()",
2776 return false);
2627 return Utils::OpenHandle(this)->HasIndexedInterceptor(); 2777 return Utils::OpenHandle(this)->HasIndexedInterceptor();
2628 } 2778 }
2629 2779
2630 2780
2631 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( 2781 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
2632 Handle<String> key) { 2782 Handle<String> key) {
2633 ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()", 2783 ON_BAILOUT(i::Isolate::Current(),
2784 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
2634 return Local<Value>()); 2785 return Local<Value>());
2635 ENTER_V8; 2786 ENTER_V8;
2636 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); 2787 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2637 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2788 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2638 i::LookupResult lookup; 2789 i::LookupResult lookup;
2639 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); 2790 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
2640 if (lookup.IsProperty()) { 2791 if (lookup.IsProperty()) {
2641 PropertyAttributes attributes; 2792 PropertyAttributes attributes;
2642 i::Object* property = 2793 i::Object* property =
2643 self_obj->GetProperty(*self_obj, 2794 self_obj->GetProperty(*self_obj,
2644 &lookup, 2795 &lookup,
2645 *key_obj, 2796 *key_obj,
2646 &attributes)->ToObjectUnchecked(); 2797 &attributes)->ToObjectUnchecked();
2647 i::Handle<i::Object> result(property); 2798 i::Handle<i::Object> result(property);
2648 return Utils::ToLocal(result); 2799 return Utils::ToLocal(result);
2649 } 2800 }
2650 return Local<Value>(); // No real property was found in prototype chain. 2801 return Local<Value>(); // No real property was found in prototype chain.
2651 } 2802 }
2652 2803
2653 2804
2654 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { 2805 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
2655 ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>()); 2806 ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetRealNamedProperty()",
2807 return Local<Value>());
2656 ENTER_V8; 2808 ENTER_V8;
2657 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); 2809 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2658 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2810 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2659 i::LookupResult lookup; 2811 i::LookupResult lookup;
2660 self_obj->LookupRealNamedProperty(*key_obj, &lookup); 2812 self_obj->LookupRealNamedProperty(*key_obj, &lookup);
2661 if (lookup.IsProperty()) { 2813 if (lookup.IsProperty()) {
2662 PropertyAttributes attributes; 2814 PropertyAttributes attributes;
2663 i::Object* property = 2815 i::Object* property =
2664 self_obj->GetProperty(*self_obj, 2816 self_obj->GetProperty(*self_obj,
2665 &lookup, 2817 &lookup,
2666 *key_obj, 2818 *key_obj,
2667 &attributes)->ToObjectUnchecked(); 2819 &attributes)->ToObjectUnchecked();
2668 i::Handle<i::Object> result(property); 2820 i::Handle<i::Object> result(property);
2669 return Utils::ToLocal(result); 2821 return Utils::ToLocal(result);
2670 } 2822 }
2671 return Local<Value>(); // No real property was found in prototype chain. 2823 return Local<Value>(); // No real property was found in prototype chain.
2672 } 2824 }
2673 2825
2674 2826
2675 // Turns on access checks by copying the map and setting the check flag. 2827 // Turns on access checks by copying the map and setting the check flag.
2676 // Because the object gets a new map, existing inline cache caching 2828 // Because the object gets a new map, existing inline cache caching
2677 // the old map of this object will fail. 2829 // the old map of this object will fail.
2678 void v8::Object::TurnOnAccessCheck() { 2830 void v8::Object::TurnOnAccessCheck() {
2679 ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return); 2831 i::Isolate* isolate = i::Isolate::Current();
2832 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return);
2680 ENTER_V8; 2833 ENTER_V8;
2681 HandleScope scope; 2834 i::HandleScope scope(isolate);
2682 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 2835 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
2683 2836
2684 // When turning on access checks for a global object deoptimize all functions 2837 // When turning on access checks for a global object deoptimize all functions
2685 // as optimized code does not always handle access checks. 2838 // as optimized code does not always handle access checks.
2686 i::Deoptimizer::DeoptimizeGlobalObject(*obj); 2839 i::Deoptimizer::DeoptimizeGlobalObject(*obj);
2687 2840
2688 i::Handle<i::Map> new_map = 2841 i::Handle<i::Map> new_map =
2689 FACTORY->CopyMapDropTransitions(i::Handle<i::Map>(obj->map())); 2842 FACTORY->CopyMapDropTransitions(i::Handle<i::Map>(obj->map()));
2690 new_map->set_is_access_check_needed(true); 2843 new_map->set_is_access_check_needed(true);
2691 obj->set_map(*new_map); 2844 obj->set_map(*new_map);
2692 } 2845 }
2693 2846
2694 2847
2695 bool v8::Object::IsDirty() { 2848 bool v8::Object::IsDirty() {
2696 return Utils::OpenHandle(this)->IsDirty(); 2849 return Utils::OpenHandle(this)->IsDirty();
2697 } 2850 }
2698 2851
2699 2852
2700 Local<v8::Object> v8::Object::Clone() { 2853 Local<v8::Object> v8::Object::Clone() {
2701 ON_BAILOUT("v8::Object::Clone()", return Local<Object>()); 2854 i::Isolate* isolate = i::Isolate::Current();
2855 ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>());
2702 ENTER_V8; 2856 ENTER_V8;
2703 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2857 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2704 EXCEPTION_PREAMBLE(); 2858 EXCEPTION_PREAMBLE();
2705 i::Handle<i::JSObject> result = i::Copy(self); 2859 i::Handle<i::JSObject> result = i::Copy(self);
2706 has_pending_exception = result.is_null(); 2860 has_pending_exception = result.is_null();
2707 EXCEPTION_BAILOUT_CHECK(Local<Object>()); 2861 EXCEPTION_BAILOUT_CHECK(Local<Object>());
2708 return Utils::ToLocal(result); 2862 return Utils::ToLocal(result);
2709 } 2863 }
2710 2864
2711 2865
2712 int v8::Object::GetIdentityHash() { 2866 int v8::Object::GetIdentityHash() {
2713 ON_BAILOUT("v8::Object::GetIdentityHash()", return 0); 2867 i::Isolate* isolate = i::Isolate::Current();
2868 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0);
2714 ENTER_V8; 2869 ENTER_V8;
2715 HandleScope scope; 2870 i::HandleScope scope(isolate);
2716 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2871 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2717 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); 2872 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true));
2718 if (!hidden_props_obj->IsJSObject()) { 2873 if (!hidden_props_obj->IsJSObject()) {
2719 // We failed to create hidden properties. That's a detached 2874 // We failed to create hidden properties. That's a detached
2720 // global proxy. 2875 // global proxy.
2721 ASSERT(hidden_props_obj->IsUndefined()); 2876 ASSERT(hidden_props_obj->IsUndefined());
2722 return 0; 2877 return 0;
2723 } 2878 }
2724 i::Handle<i::JSObject> hidden_props = 2879 i::Handle<i::JSObject> hidden_props =
2725 i::Handle<i::JSObject>::cast(hidden_props_obj); 2880 i::Handle<i::JSObject>::cast(hidden_props_obj);
(...skipping 19 matching lines...) Expand all
2745 hash_symbol, 2900 hash_symbol,
2746 i::Handle<i::Object>(i::Smi::FromInt(hash_value)), 2901 i::Handle<i::Object>(i::Smi::FromInt(hash_value)),
2747 static_cast<PropertyAttributes>(None)).is_null()); 2902 static_cast<PropertyAttributes>(None)).is_null());
2748 2903
2749 return hash_value; 2904 return hash_value;
2750 } 2905 }
2751 2906
2752 2907
2753 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, 2908 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
2754 v8::Handle<v8::Value> value) { 2909 v8::Handle<v8::Value> value) {
2755 ON_BAILOUT("v8::Object::SetHiddenValue()", return false); 2910 i::Isolate* isolate = i::Isolate::Current();
2911 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false);
2756 ENTER_V8; 2912 ENTER_V8;
2757 HandleScope scope; 2913 i::HandleScope scope(isolate);
2758 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2914 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2759 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true)); 2915 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
2760 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 2916 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2761 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2917 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2762 EXCEPTION_PREAMBLE(); 2918 EXCEPTION_PREAMBLE();
2763 i::Handle<i::Object> obj = i::SetProperty( 2919 i::Handle<i::Object> obj = i::SetProperty(
2764 hidden_props, 2920 hidden_props,
2765 key_obj, 2921 key_obj,
2766 value_obj, 2922 value_obj,
2767 static_cast<PropertyAttributes>(None), 2923 static_cast<PropertyAttributes>(None),
2768 i::kNonStrictMode); 2924 i::kNonStrictMode);
2769 has_pending_exception = obj.is_null(); 2925 has_pending_exception = obj.is_null();
2770 EXCEPTION_BAILOUT_CHECK(false); 2926 EXCEPTION_BAILOUT_CHECK(false);
2771 return true; 2927 return true;
2772 } 2928 }
2773 2929
2774 2930
2775 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { 2931 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
2776 ON_BAILOUT("v8::Object::GetHiddenValue()", return Local<v8::Value>()); 2932 i::Isolate* isolate = i::Isolate::Current();
2933 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()",
2934 return Local<v8::Value>());
2777 ENTER_V8; 2935 ENTER_V8;
2778 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2936 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2779 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false)); 2937 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
2780 if (hidden_props->IsUndefined()) { 2938 if (hidden_props->IsUndefined()) {
2781 return v8::Local<v8::Value>(); 2939 return v8::Local<v8::Value>();
2782 } 2940 }
2783 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2941 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2784 EXCEPTION_PREAMBLE(); 2942 EXCEPTION_PREAMBLE();
2785 i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj); 2943 i::Handle<i::Object> result = i::GetProperty(hidden_props, key_obj);
2786 has_pending_exception = result.is_null(); 2944 has_pending_exception = result.is_null();
2787 EXCEPTION_BAILOUT_CHECK(v8::Local<v8::Value>()); 2945 EXCEPTION_BAILOUT_CHECK(v8::Local<v8::Value>());
2788 if (result->IsUndefined()) { 2946 if (result->IsUndefined()) {
2789 return v8::Local<v8::Value>(); 2947 return v8::Local<v8::Value>();
2790 } 2948 }
2791 return Utils::ToLocal(result); 2949 return Utils::ToLocal(result);
2792 } 2950 }
2793 2951
2794 2952
2795 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) { 2953 bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
2796 ON_BAILOUT("v8::DeleteHiddenValue()", return false); 2954 i::Isolate* isolate = i::Isolate::Current();
2955 ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false);
2797 ENTER_V8; 2956 ENTER_V8;
2798 HandleScope scope; 2957 i::HandleScope scope(isolate);
2799 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2958 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2800 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false)); 2959 i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
2801 if (hidden_props->IsUndefined()) { 2960 if (hidden_props->IsUndefined()) {
2802 return true; 2961 return true;
2803 } 2962 }
2804 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props)); 2963 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props));
2805 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2964 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2806 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); 2965 return i::DeleteProperty(js_obj, key_obj)->IsTrue();
2807 } 2966 }
2808 2967
(...skipping 21 matching lines...) Expand all
2830 i::Handle<i::Map>(object->map())); 2989 i::Handle<i::Map>(object->map()));
2831 object->set_map(*external_array_map); 2990 object->set_map(*external_array_map);
2832 } 2991 }
2833 object->set_elements(*array); 2992 object->set_elements(*array);
2834 } 2993 }
2835 2994
2836 } // namespace 2995 } // namespace
2837 2996
2838 2997
2839 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { 2998 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) {
2840 ON_BAILOUT("v8::SetElementsToPixelData()", return); 2999 i::Isolate* isolate = i::Isolate::Current();
3000 ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
2841 ENTER_V8; 3001 ENTER_V8;
2842 HandleScope scope; 3002 i::HandleScope scope(isolate);
2843 if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength, 3003 if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength,
2844 "v8::Object::SetIndexedPropertiesToPixelData()", 3004 "v8::Object::SetIndexedPropertiesToPixelData()",
2845 "length exceeds max acceptable value")) { 3005 "length exceeds max acceptable value")) {
2846 return; 3006 return;
2847 } 3007 }
2848 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3008 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2849 if (!ApiCheck(!self->IsJSArray(), 3009 if (!ApiCheck(!self->IsJSArray(),
2850 "v8::Object::SetIndexedPropertiesToPixelData()", 3010 "v8::Object::SetIndexedPropertiesToPixelData()",
2851 "JSArray is not supported")) { 3011 "JSArray is not supported")) {
2852 return; 3012 return;
2853 } 3013 }
2854 PrepareExternalArrayElements(self, data, kExternalPixelArray, length); 3014 PrepareExternalArrayElements(self, data, kExternalPixelArray, length);
2855 } 3015 }
2856 3016
2857 3017
2858 bool v8::Object::HasIndexedPropertiesInPixelData() { 3018 bool v8::Object::HasIndexedPropertiesInPixelData() {
2859 ON_BAILOUT("v8::HasIndexedPropertiesInPixelData()", return false); 3019 ON_BAILOUT(i::Isolate::Current(), "v8::HasIndexedPropertiesInPixelData()",
3020 return false);
2860 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3021 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2861 return self->HasExternalPixelElements(); 3022 return self->HasExternalPixelElements();
2862 } 3023 }
2863 3024
2864 3025
2865 uint8_t* v8::Object::GetIndexedPropertiesPixelData() { 3026 uint8_t* v8::Object::GetIndexedPropertiesPixelData() {
2866 ON_BAILOUT("v8::GetIndexedPropertiesPixelData()", return NULL); 3027 ON_BAILOUT(i::Isolate::Current(), "v8::GetIndexedPropertiesPixelData()",
3028 return NULL);
2867 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3029 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2868 if (self->HasExternalPixelElements()) { 3030 if (self->HasExternalPixelElements()) {
2869 return i::ExternalPixelArray::cast(self->elements())-> 3031 return i::ExternalPixelArray::cast(self->elements())->
2870 external_pixel_pointer(); 3032 external_pixel_pointer();
2871 } else { 3033 } else {
2872 return NULL; 3034 return NULL;
2873 } 3035 }
2874 } 3036 }
2875 3037
2876 3038
2877 int v8::Object::GetIndexedPropertiesPixelDataLength() { 3039 int v8::Object::GetIndexedPropertiesPixelDataLength() {
2878 ON_BAILOUT("v8::GetIndexedPropertiesPixelDataLength()", return -1); 3040 ON_BAILOUT(i::Isolate::Current(), "v8::GetIndexedPropertiesPixelDataLength()",
3041 return -1);
2879 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3042 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2880 if (self->HasExternalPixelElements()) { 3043 if (self->HasExternalPixelElements()) {
2881 return i::ExternalPixelArray::cast(self->elements())->length(); 3044 return i::ExternalPixelArray::cast(self->elements())->length();
2882 } else { 3045 } else {
2883 return -1; 3046 return -1;
2884 } 3047 }
2885 } 3048 }
2886 3049
2887 void v8::Object::SetIndexedPropertiesToExternalArrayData( 3050 void v8::Object::SetIndexedPropertiesToExternalArrayData(
2888 void* data, 3051 void* data,
2889 ExternalArrayType array_type, 3052 ExternalArrayType array_type,
2890 int length) { 3053 int length) {
2891 ON_BAILOUT("v8::SetIndexedPropertiesToExternalArrayData()", return); 3054 i::Isolate* isolate = i::Isolate::Current();
3055 ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return);
2892 ENTER_V8; 3056 ENTER_V8;
2893 HandleScope scope; 3057 i::HandleScope scope(isolate);
2894 if (!ApiCheck(length <= i::ExternalArray::kMaxLength, 3058 if (!ApiCheck(length <= i::ExternalArray::kMaxLength,
2895 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3059 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
2896 "length exceeds max acceptable value")) { 3060 "length exceeds max acceptable value")) {
2897 return; 3061 return;
2898 } 3062 }
2899 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3063 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2900 if (!ApiCheck(!self->IsJSArray(), 3064 if (!ApiCheck(!self->IsJSArray(),
2901 "v8::Object::SetIndexedPropertiesToExternalArrayData()", 3065 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
2902 "JSArray is not supported")) { 3066 "JSArray is not supported")) {
2903 return; 3067 return;
2904 } 3068 }
2905 PrepareExternalArrayElements(self, data, array_type, length); 3069 PrepareExternalArrayElements(self, data, array_type, length);
2906 } 3070 }
2907 3071
2908 3072
2909 bool v8::Object::HasIndexedPropertiesInExternalArrayData() { 3073 bool v8::Object::HasIndexedPropertiesInExternalArrayData() {
2910 ON_BAILOUT("v8::HasIndexedPropertiesInExternalArrayData()", return false); 3074 ON_BAILOUT(i::Isolate::Current(),
3075 "v8::HasIndexedPropertiesInExternalArrayData()",
3076 return false);
2911 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3077 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2912 return self->HasExternalArrayElements(); 3078 return self->HasExternalArrayElements();
2913 } 3079 }
2914 3080
2915 3081
2916 void* v8::Object::GetIndexedPropertiesExternalArrayData() { 3082 void* v8::Object::GetIndexedPropertiesExternalArrayData() {
2917 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayData()", return NULL); 3083 ON_BAILOUT(i::Isolate::Current(),
3084 "v8::GetIndexedPropertiesExternalArrayData()",
3085 return NULL);
2918 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3086 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2919 if (self->HasExternalArrayElements()) { 3087 if (self->HasExternalArrayElements()) {
2920 return i::ExternalArray::cast(self->elements())->external_pointer(); 3088 return i::ExternalArray::cast(self->elements())->external_pointer();
2921 } else { 3089 } else {
2922 return NULL; 3090 return NULL;
2923 } 3091 }
2924 } 3092 }
2925 3093
2926 3094
2927 ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType() { 3095 ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType() {
2928 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataType()", 3096 ON_BAILOUT(i::Isolate::Current(),
3097 "v8::GetIndexedPropertiesExternalArrayDataType()",
2929 return static_cast<ExternalArrayType>(-1)); 3098 return static_cast<ExternalArrayType>(-1));
2930 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3099 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2931 switch (self->elements()->map()->instance_type()) { 3100 switch (self->elements()->map()->instance_type()) {
2932 case i::EXTERNAL_BYTE_ARRAY_TYPE: 3101 case i::EXTERNAL_BYTE_ARRAY_TYPE:
2933 return kExternalByteArray; 3102 return kExternalByteArray;
2934 case i::EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 3103 case i::EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
2935 return kExternalUnsignedByteArray; 3104 return kExternalUnsignedByteArray;
2936 case i::EXTERNAL_SHORT_ARRAY_TYPE: 3105 case i::EXTERNAL_SHORT_ARRAY_TYPE:
2937 return kExternalShortArray; 3106 return kExternalShortArray;
2938 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 3107 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
2939 return kExternalUnsignedShortArray; 3108 return kExternalUnsignedShortArray;
2940 case i::EXTERNAL_INT_ARRAY_TYPE: 3109 case i::EXTERNAL_INT_ARRAY_TYPE:
2941 return kExternalIntArray; 3110 return kExternalIntArray;
2942 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 3111 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
2943 return kExternalUnsignedIntArray; 3112 return kExternalUnsignedIntArray;
2944 case i::EXTERNAL_FLOAT_ARRAY_TYPE: 3113 case i::EXTERNAL_FLOAT_ARRAY_TYPE:
2945 return kExternalFloatArray; 3114 return kExternalFloatArray;
2946 case i::EXTERNAL_PIXEL_ARRAY_TYPE: 3115 case i::EXTERNAL_PIXEL_ARRAY_TYPE:
2947 return kExternalPixelArray; 3116 return kExternalPixelArray;
2948 default: 3117 default:
2949 return static_cast<ExternalArrayType>(-1); 3118 return static_cast<ExternalArrayType>(-1);
2950 } 3119 }
2951 } 3120 }
2952 3121
2953 3122
2954 int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { 3123 int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
2955 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataLength()", return 0); 3124 ON_BAILOUT(i::Isolate::Current(),
3125 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3126 return 0);
2956 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3127 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2957 if (self->HasExternalArrayElements()) { 3128 if (self->HasExternalArrayElements()) {
2958 return i::ExternalArray::cast(self->elements())->length(); 3129 return i::ExternalArray::cast(self->elements())->length();
2959 } else { 3130 } else {
2960 return -1; 3131 return -1;
2961 } 3132 }
2962 } 3133 }
2963 3134
2964 3135
2965 Local<v8::Object> Function::NewInstance() const { 3136 Local<v8::Object> Function::NewInstance() const {
2966 return NewInstance(0, NULL); 3137 return NewInstance(0, NULL);
2967 } 3138 }
2968 3139
2969 3140
2970 Local<v8::Object> Function::NewInstance(int argc, 3141 Local<v8::Object> Function::NewInstance(int argc,
2971 v8::Handle<v8::Value> argv[]) const { 3142 v8::Handle<v8::Value> argv[]) const {
2972 ON_BAILOUT("v8::Function::NewInstance()", return Local<v8::Object>()); 3143 i::Isolate* isolate = i::Isolate::Current();
2973 LOG_API("Function::NewInstance"); 3144 ON_BAILOUT(isolate, "v8::Function::NewInstance()",
3145 return Local<v8::Object>());
3146 LOG_API(isolate, "Function::NewInstance");
2974 ENTER_V8; 3147 ENTER_V8;
2975 HandleScope scope; 3148 HandleScope scope;
2976 i::Handle<i::JSFunction> function = Utils::OpenHandle(this); 3149 i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
2977 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3150 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
2978 i::Object*** args = reinterpret_cast<i::Object***>(argv); 3151 i::Object*** args = reinterpret_cast<i::Object***>(argv);
2979 EXCEPTION_PREAMBLE(); 3152 EXCEPTION_PREAMBLE();
2980 i::Handle<i::Object> returned = 3153 i::Handle<i::Object> returned =
2981 i::Execution::New(function, argc, args, &has_pending_exception); 3154 i::Execution::New(function, argc, args, &has_pending_exception);
2982 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>()); 3155 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
2983 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); 3156 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
2984 } 3157 }
2985 3158
2986 3159
2987 Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc, 3160 Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
2988 v8::Handle<v8::Value> argv[]) { 3161 v8::Handle<v8::Value> argv[]) {
2989 ON_BAILOUT("v8::Function::Call()", return Local<v8::Value>()); 3162 i::Isolate* isolate = i::Isolate::Current();
2990 LOG_API("Function::Call"); 3163 ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>());
3164 LOG_API(isolate, "Function::Call");
2991 ENTER_V8; 3165 ENTER_V8;
2992 i::Object* raw_result = NULL; 3166 i::Object* raw_result = NULL;
2993 { 3167 {
2994 HandleScope scope; 3168 i::HandleScope scope(isolate);
2995 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); 3169 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
2996 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 3170 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
2997 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 3171 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
2998 i::Object*** args = reinterpret_cast<i::Object***>(argv); 3172 i::Object*** args = reinterpret_cast<i::Object***>(argv);
2999 EXCEPTION_PREAMBLE(); 3173 EXCEPTION_PREAMBLE();
3000 i::Handle<i::Object> returned = 3174 i::Handle<i::Object> returned =
3001 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); 3175 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
3002 EXCEPTION_BAILOUT_CHECK(Local<Object>()); 3176 EXCEPTION_BAILOUT_CHECK(Local<Object>());
3003 raw_result = *returned; 3177 raw_result = *returned;
3004 } 3178 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3041 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 3215 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3042 if (func->shared()->script()->IsScript()) { 3216 if (func->shared()->script()->IsScript()) {
3043 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); 3217 i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
3044 return i::GetScriptLineNumber(script, func->shared()->start_position()); 3218 return i::GetScriptLineNumber(script, func->shared()->start_position());
3045 } 3219 }
3046 return kLineOffsetNotFound; 3220 return kLineOffsetNotFound;
3047 } 3221 }
3048 3222
3049 3223
3050 int String::Length() const { 3224 int String::Length() const {
3051 if (IsDeadCheck("v8::String::Length()")) return 0; 3225 if (IsDeadCheck(i::Isolate::Current(), "v8::String::Length()")) return 0;
3052 return Utils::OpenHandle(this)->length(); 3226 return Utils::OpenHandle(this)->length();
3053 } 3227 }
3054 3228
3055 3229
3056 int String::Utf8Length() const { 3230 int String::Utf8Length() const {
3057 if (IsDeadCheck("v8::String::Utf8Length()")) return 0; 3231 if (IsDeadCheck(i::Isolate::Current(), "v8::String::Utf8Length()")) return 0;
3058 return Utils::OpenHandle(this)->Utf8Length(); 3232 return Utils::OpenHandle(this)->Utf8Length();
3059 } 3233 }
3060 3234
3061 3235
3062 int String::WriteUtf8(char* buffer, 3236 int String::WriteUtf8(char* buffer,
3063 int capacity, 3237 int capacity,
3064 int* nchars_ref, 3238 int* nchars_ref,
3065 WriteHints hints) const { 3239 WriteHints hints) const {
3066 if (IsDeadCheck("v8::String::WriteUtf8()")) return 0; 3240 i::Isolate* isolate = i::Isolate::Current();
3067 LOG_API("String::WriteUtf8"); 3241 if (IsDeadCheck(isolate, "v8::String::WriteUtf8()")) return 0;
3242 LOG_API(isolate, "String::WriteUtf8");
3068 ENTER_V8; 3243 ENTER_V8;
3069 i::Isolate* isolate = i::Isolate::Current();
3070 i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer(); 3244 i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
3071 i::Handle<i::String> str = Utils::OpenHandle(this); 3245 i::Handle<i::String> str = Utils::OpenHandle(this);
3072 isolate->string_tracker()->RecordWrite(str); 3246 isolate->string_tracker()->RecordWrite(str);
3073 if (hints & HINT_MANY_WRITES_EXPECTED) { 3247 if (hints & HINT_MANY_WRITES_EXPECTED) {
3074 // Flatten the string for efficiency. This applies whether we are 3248 // Flatten the string for efficiency. This applies whether we are
3075 // using StringInputBuffer or Get(i) to access the characters. 3249 // using StringInputBuffer or Get(i) to access the characters.
3076 str->TryFlatten(); 3250 str->TryFlatten();
3077 } 3251 }
3078 write_input_buffer.Reset(0, *str); 3252 write_input_buffer.Reset(0, *str);
3079 int len = str->length(); 3253 int len = str->length();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 if (i == len && (capacity == -1 || pos < capacity)) 3287 if (i == len && (capacity == -1 || pos < capacity))
3114 buffer[pos++] = '\0'; 3288 buffer[pos++] = '\0';
3115 return pos; 3289 return pos;
3116 } 3290 }
3117 3291
3118 3292
3119 int String::WriteAscii(char* buffer, 3293 int String::WriteAscii(char* buffer,
3120 int start, 3294 int start,
3121 int length, 3295 int length,
3122 WriteHints hints) const { 3296 WriteHints hints) const {
3123 if (IsDeadCheck("v8::String::WriteAscii()")) return 0; 3297 i::Isolate* isolate = i::Isolate::Current();
3124 LOG_API("String::WriteAscii"); 3298 if (IsDeadCheck(isolate, "v8::String::WriteAscii()")) return 0;
3299 LOG_API(isolate, "String::WriteAscii");
3125 ENTER_V8; 3300 ENTER_V8;
3126 i::Isolate* isolate = i::Isolate::Current();
3127 i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer(); 3301 i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
3128 ASSERT(start >= 0 && length >= -1); 3302 ASSERT(start >= 0 && length >= -1);
3129 i::Handle<i::String> str = Utils::OpenHandle(this); 3303 i::Handle<i::String> str = Utils::OpenHandle(this);
3130 isolate->string_tracker()->RecordWrite(str); 3304 isolate->string_tracker()->RecordWrite(str);
3131 if (hints & HINT_MANY_WRITES_EXPECTED) { 3305 if (hints & HINT_MANY_WRITES_EXPECTED) {
3132 // Flatten the string for efficiency. This applies whether we are 3306 // Flatten the string for efficiency. This applies whether we are
3133 // using StringInputBuffer or Get(i) to access the characters. 3307 // using StringInputBuffer or Get(i) to access the characters.
3134 str->TryFlatten(); 3308 str->TryFlatten();
3135 } 3309 }
3136 int end = length; 3310 int end = length;
(...skipping 10 matching lines...) Expand all
3147 if (length == -1 || i < length) 3321 if (length == -1 || i < length)
3148 buffer[i] = '\0'; 3322 buffer[i] = '\0';
3149 return i; 3323 return i;
3150 } 3324 }
3151 3325
3152 3326
3153 int String::Write(uint16_t* buffer, 3327 int String::Write(uint16_t* buffer,
3154 int start, 3328 int start,
3155 int length, 3329 int length,
3156 WriteHints hints) const { 3330 WriteHints hints) const {
3157 if (IsDeadCheck("v8::String::Write()")) return 0; 3331 i::Isolate* isolate = i::Isolate::Current();
3158 LOG_API("String::Write"); 3332 if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
3333 LOG_API(isolate, "String::Write");
3159 ENTER_V8; 3334 ENTER_V8;
3160 ASSERT(start >= 0 && length >= -1); 3335 ASSERT(start >= 0 && length >= -1);
3161 i::Handle<i::String> str = Utils::OpenHandle(this); 3336 i::Handle<i::String> str = Utils::OpenHandle(this);
3162 i::Isolate::Current()->string_tracker()->RecordWrite(str); 3337 isolate->string_tracker()->RecordWrite(str);
3163 if (hints & HINT_MANY_WRITES_EXPECTED) { 3338 if (hints & HINT_MANY_WRITES_EXPECTED) {
3164 // Flatten the string for efficiency. This applies whether we are 3339 // Flatten the string for efficiency. This applies whether we are
3165 // using StringInputBuffer or Get(i) to access the characters. 3340 // using StringInputBuffer or Get(i) to access the characters.
3166 str->TryFlatten(); 3341 str->TryFlatten();
3167 } 3342 }
3168 int end = start + length; 3343 int end = start + length;
3169 if ((length == -1) || (length > str->length() - start) ) 3344 if ((length == -1) || (length > str->length() - start) )
3170 end = str->length(); 3345 end = str->length();
3171 if (end < 0) return 0; 3346 if (end < 0) return 0;
3172 i::String::WriteToFlat(*str, buffer, start, end); 3347 i::String::WriteToFlat(*str, buffer, start, end);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 if (i::StringShape(*str).IsExternalAscii()) { 3387 if (i::StringShape(*str).IsExternalAscii()) {
3213 void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource(); 3388 void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource();
3214 return reinterpret_cast<ExternalAsciiStringResource*>(resource); 3389 return reinterpret_cast<ExternalAsciiStringResource*>(resource);
3215 } else { 3390 } else {
3216 return NULL; 3391 return NULL;
3217 } 3392 }
3218 } 3393 }
3219 3394
3220 3395
3221 double Number::Value() const { 3396 double Number::Value() const {
3222 if (IsDeadCheck("v8::Number::Value()")) return 0; 3397 if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Value()")) return 0;
3223 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3398 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3224 return obj->Number(); 3399 return obj->Number();
3225 } 3400 }
3226 3401
3227 3402
3228 bool Boolean::Value() const { 3403 bool Boolean::Value() const {
3229 if (IsDeadCheck("v8::Boolean::Value()")) return false; 3404 if (IsDeadCheck(i::Isolate::Current(), "v8::Boolean::Value()")) return false;
3230 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3405 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3231 return obj->IsTrue(); 3406 return obj->IsTrue();
3232 } 3407 }
3233 3408
3234 3409
3235 int64_t Integer::Value() const { 3410 int64_t Integer::Value() const {
3236 if (IsDeadCheck("v8::Integer::Value()")) return 0; 3411 if (IsDeadCheck(i::Isolate::Current(), "v8::Integer::Value()")) return 0;
3237 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3412 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3238 if (obj->IsSmi()) { 3413 if (obj->IsSmi()) {
3239 return i::Smi::cast(*obj)->value(); 3414 return i::Smi::cast(*obj)->value();
3240 } else { 3415 } else {
3241 return static_cast<int64_t>(obj->Number()); 3416 return static_cast<int64_t>(obj->Number());
3242 } 3417 }
3243 } 3418 }
3244 3419
3245 3420
3246 int32_t Int32::Value() const { 3421 int32_t Int32::Value() const {
3247 if (IsDeadCheck("v8::Int32::Value()")) return 0; 3422 if (IsDeadCheck(i::Isolate::Current(), "v8::Int32::Value()")) return 0;
3248 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3423 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3249 if (obj->IsSmi()) { 3424 if (obj->IsSmi()) {
3250 return i::Smi::cast(*obj)->value(); 3425 return i::Smi::cast(*obj)->value();
3251 } else { 3426 } else {
3252 return static_cast<int32_t>(obj->Number()); 3427 return static_cast<int32_t>(obj->Number());
3253 } 3428 }
3254 } 3429 }
3255 3430
3256 3431
3257 uint32_t Uint32::Value() const { 3432 uint32_t Uint32::Value() const {
3258 if (IsDeadCheck("v8::Uint32::Value()")) return 0; 3433 if (IsDeadCheck(i::Isolate::Current(), "v8::Uint32::Value()")) return 0;
3259 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3434 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3260 if (obj->IsSmi()) { 3435 if (obj->IsSmi()) {
3261 return i::Smi::cast(*obj)->value(); 3436 return i::Smi::cast(*obj)->value();
3262 } else { 3437 } else {
3263 return static_cast<uint32_t>(obj->Number()); 3438 return static_cast<uint32_t>(obj->Number());
3264 } 3439 }
3265 } 3440 }
3266 3441
3267 3442
3268 int v8::Object::InternalFieldCount() { 3443 int v8::Object::InternalFieldCount() {
3269 if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0; 3444 if (IsDeadCheck(i::Isolate::Current(), "v8::Object::InternalFieldCount()")) {
3445 return 0;
3446 }
3270 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3447 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3271 return obj->GetInternalFieldCount(); 3448 return obj->GetInternalFieldCount();
3272 } 3449 }
3273 3450
3274 3451
3275 Local<Value> v8::Object::CheckedGetInternalField(int index) { 3452 Local<Value> v8::Object::CheckedGetInternalField(int index) {
3276 if (IsDeadCheck("v8::Object::GetInternalField()")) return Local<Value>(); 3453 if (IsDeadCheck(i::Isolate::Current(), "v8::Object::GetInternalField()")) {
3454 return Local<Value>();
3455 }
3277 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3456 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3278 if (!ApiCheck(index < obj->GetInternalFieldCount(), 3457 if (!ApiCheck(index < obj->GetInternalFieldCount(),
3279 "v8::Object::GetInternalField()", 3458 "v8::Object::GetInternalField()",
3280 "Reading internal field out of bounds")) { 3459 "Reading internal field out of bounds")) {
3281 return Local<Value>(); 3460 return Local<Value>();
3282 } 3461 }
3283 i::Handle<i::Object> value(obj->GetInternalField(index)); 3462 i::Handle<i::Object> value(obj->GetInternalField(index));
3284 Local<Value> result = Utils::ToLocal(value); 3463 Local<Value> result = Utils::ToLocal(value);
3285 #ifdef DEBUG 3464 #ifdef DEBUG
3286 Local<Value> unchecked = UncheckedGetInternalField(index); 3465 Local<Value> unchecked = UncheckedGetInternalField(index);
3287 ASSERT(unchecked.IsEmpty() || (unchecked == result)); 3466 ASSERT(unchecked.IsEmpty() || (unchecked == result));
3288 #endif 3467 #endif
3289 return result; 3468 return result;
3290 } 3469 }
3291 3470
3292 3471
3293 void v8::Object::SetInternalField(int index, v8::Handle<Value> value) { 3472 void v8::Object::SetInternalField(int index, v8::Handle<Value> value) {
3294 if (IsDeadCheck("v8::Object::SetInternalField()")) return; 3473 if (IsDeadCheck(i::Isolate::Current(), "v8::Object::SetInternalField()")) {
3474 return;
3475 }
3295 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3476 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3296 if (!ApiCheck(index < obj->GetInternalFieldCount(), 3477 if (!ApiCheck(index < obj->GetInternalFieldCount(),
3297 "v8::Object::SetInternalField()", 3478 "v8::Object::SetInternalField()",
3298 "Writing internal field out of bounds")) { 3479 "Writing internal field out of bounds")) {
3299 return; 3480 return;
3300 } 3481 }
3301 ENTER_V8; 3482 ENTER_V8;
3302 i::Handle<i::Object> val = Utils::OpenHandle(*value); 3483 i::Handle<i::Object> val = Utils::OpenHandle(*value);
3303 obj->SetInternalField(index, *val); 3484 obj->SetInternalField(index, *val);
3304 } 3485 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3409 } 3590 }
3410 return i::Handle<i::FunctionTemplateInfo>( 3591 return i::Handle<i::FunctionTemplateInfo>(
3411 i::FunctionTemplateInfo::cast(templ->constructor())); 3592 i::FunctionTemplateInfo::cast(templ->constructor()));
3412 } 3593 }
3413 3594
3414 3595
3415 Persistent<Context> v8::Context::New( 3596 Persistent<Context> v8::Context::New(
3416 v8::ExtensionConfiguration* extensions, 3597 v8::ExtensionConfiguration* extensions,
3417 v8::Handle<ObjectTemplate> global_template, 3598 v8::Handle<ObjectTemplate> global_template,
3418 v8::Handle<Value> global_object) { 3599 v8::Handle<Value> global_object) {
3419 EnsureInitialized("v8::Context::New()"); 3600 i::Isolate* isolate = i::Isolate::Current();
3420 LOG_API("Context::New"); 3601 EnsureInitializedForIsolate(isolate, "v8::Context::New()");
3421 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); 3602 LOG_API(isolate, "Context::New");
3603 ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>());
3422 3604
3423 // Enter V8 via an ENTER_V8 scope. 3605 // Enter V8 via an ENTER_V8 scope.
3424 i::Handle<i::Context> env; 3606 i::Handle<i::Context> env;
3425 { 3607 {
3426 ENTER_V8; 3608 ENTER_V8;
3427 v8::Handle<ObjectTemplate> proxy_template = global_template; 3609 v8::Handle<ObjectTemplate> proxy_template = global_template;
3428 i::Handle<i::FunctionTemplateInfo> proxy_constructor; 3610 i::Handle<i::FunctionTemplateInfo> proxy_constructor;
3429 i::Handle<i::FunctionTemplateInfo> global_constructor; 3611 i::Handle<i::FunctionTemplateInfo> global_constructor;
3430 3612
3431 if (!global_template.IsEmpty()) { 3613 if (!global_template.IsEmpty()) {
(...skipping 18 matching lines...) Expand all
3450 proxy_constructor->set_access_check_info( 3632 proxy_constructor->set_access_check_info(
3451 global_constructor->access_check_info()); 3633 global_constructor->access_check_info());
3452 proxy_constructor->set_needs_access_check( 3634 proxy_constructor->set_needs_access_check(
3453 global_constructor->needs_access_check()); 3635 global_constructor->needs_access_check());
3454 global_constructor->set_needs_access_check(false); 3636 global_constructor->set_needs_access_check(false);
3455 global_constructor->set_access_check_info(HEAP->undefined_value()); 3637 global_constructor->set_access_check_info(HEAP->undefined_value());
3456 } 3638 }
3457 } 3639 }
3458 3640
3459 // Create the environment. 3641 // Create the environment.
3460 env = i::Isolate::Current()->bootstrapper()->CreateEnvironment( 3642 env = isolate->bootstrapper()->CreateEnvironment(
3461 Utils::OpenHandle(*global_object), 3643 Utils::OpenHandle(*global_object),
3462 proxy_template, 3644 proxy_template,
3463 extensions); 3645 extensions);
3464 3646
3465 // Restore the access check info on the global template. 3647 // Restore the access check info on the global template.
3466 if (!global_template.IsEmpty()) { 3648 if (!global_template.IsEmpty()) {
3467 ASSERT(!global_constructor.is_null()); 3649 ASSERT(!global_constructor.is_null());
3468 ASSERT(!proxy_constructor.is_null()); 3650 ASSERT(!proxy_constructor.is_null());
3469 global_constructor->set_access_check_info( 3651 global_constructor->set_access_check_info(
3470 proxy_constructor->access_check_info()); 3652 proxy_constructor->access_check_info());
3471 global_constructor->set_needs_access_check( 3653 global_constructor->set_needs_access_check(
3472 proxy_constructor->needs_access_check()); 3654 proxy_constructor->needs_access_check());
3473 } 3655 }
3474 i::Isolate::Current()->runtime_profiler()->Reset(); 3656 i::Isolate::Current()->runtime_profiler()->Reset();
3475 } 3657 }
3476 // Leave V8. 3658 // Leave V8.
3477 3659
3478 if (env.is_null()) 3660 if (env.is_null())
3479 return Persistent<Context>(); 3661 return Persistent<Context>();
3480 return Persistent<Context>(Utils::ToLocal(env)); 3662 return Persistent<Context>(Utils::ToLocal(env));
3481 } 3663 }
3482 3664
3483 3665
3484 void v8::Context::SetSecurityToken(Handle<Value> token) { 3666 void v8::Context::SetSecurityToken(Handle<Value> token) {
3485 if (IsDeadCheck("v8::Context::SetSecurityToken()")) return; 3667 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::SetSecurityToken()")) {
3668 return;
3669 }
3486 ENTER_V8; 3670 ENTER_V8;
3487 i::Handle<i::Context> env = Utils::OpenHandle(this); 3671 i::Handle<i::Context> env = Utils::OpenHandle(this);
3488 i::Handle<i::Object> token_handle = Utils::OpenHandle(*token); 3672 i::Handle<i::Object> token_handle = Utils::OpenHandle(*token);
3489 env->set_security_token(*token_handle); 3673 env->set_security_token(*token_handle);
3490 } 3674 }
3491 3675
3492 3676
3493 void v8::Context::UseDefaultSecurityToken() { 3677 void v8::Context::UseDefaultSecurityToken() {
3494 if (IsDeadCheck("v8::Context::UseDefaultSecurityToken()")) return; 3678 if (IsDeadCheck(i::Isolate::Current(),
3679 "v8::Context::UseDefaultSecurityToken()")) {
3680 return;
3681 }
3495 ENTER_V8; 3682 ENTER_V8;
3496 i::Handle<i::Context> env = Utils::OpenHandle(this); 3683 i::Handle<i::Context> env = Utils::OpenHandle(this);
3497 env->set_security_token(env->global()); 3684 env->set_security_token(env->global());
3498 } 3685 }
3499 3686
3500 3687
3501 Handle<Value> v8::Context::GetSecurityToken() { 3688 Handle<Value> v8::Context::GetSecurityToken() {
3502 if (IsDeadCheck("v8::Context::GetSecurityToken()")) return Handle<Value>(); 3689 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::GetSecurityToken()")) {
3690 return Handle<Value>();
3691 }
3503 i::Handle<i::Context> env = Utils::OpenHandle(this); 3692 i::Handle<i::Context> env = Utils::OpenHandle(this);
3504 i::Object* security_token = env->security_token(); 3693 i::Object* security_token = env->security_token();
3505 i::Handle<i::Object> token_handle(security_token); 3694 i::Handle<i::Object> token_handle(security_token);
3506 return Utils::ToLocal(token_handle); 3695 return Utils::ToLocal(token_handle);
3507 } 3696 }
3508 3697
3509 3698
3510 bool Context::HasOutOfMemoryException() { 3699 bool Context::HasOutOfMemoryException() {
3511 i::Handle<i::Context> env = Utils::OpenHandle(this); 3700 i::Handle<i::Context> env = Utils::OpenHandle(this);
3512 return env->has_out_of_memory(); 3701 return env->has_out_of_memory();
3513 } 3702 }
3514 3703
3515 3704
3516 bool Context::InContext() { 3705 bool Context::InContext() {
3517 return i::Isolate::Current()->context() != NULL; 3706 return i::Isolate::Current()->context() != NULL;
3518 } 3707 }
3519 3708
3520 3709
3521 v8::Local<v8::Context> Context::GetEntered() { 3710 v8::Local<v8::Context> Context::GetEntered() {
3522 if (IsDeadCheck("v8::Context::GetEntered()")) return Local<Context>(); 3711 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::GetEntered()")) {
3712 return Local<Context>();
3713 }
3523 i::Handle<i::Object> last = 3714 i::Handle<i::Object> last =
3524 i::Isolate::Current()->handle_scope_implementer()->LastEnteredContext(); 3715 i::Isolate::Current()->handle_scope_implementer()->LastEnteredContext();
3525 if (last.is_null()) return Local<Context>(); 3716 if (last.is_null()) return Local<Context>();
3526 i::Handle<i::Context> context = i::Handle<i::Context>::cast(last); 3717 i::Handle<i::Context> context = i::Handle<i::Context>::cast(last);
3527 return Utils::ToLocal(context); 3718 return Utils::ToLocal(context);
3528 } 3719 }
3529 3720
3530 3721
3531 v8::Local<v8::Context> Context::GetCurrent() { 3722 v8::Local<v8::Context> Context::GetCurrent() {
3532 if (IsDeadCheck("v8::Context::GetCurrent()")) return Local<Context>(); 3723 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::GetCurrent()")) {
3724 return Local<Context>();
3725 }
3533 i::Handle<i::Object> current = i::Isolate::Current()->global_context(); 3726 i::Handle<i::Object> current = i::Isolate::Current()->global_context();
3534 if (current.is_null()) return Local<Context>(); 3727 if (current.is_null()) return Local<Context>();
3535 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current); 3728 i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
3536 return Utils::ToLocal(context); 3729 return Utils::ToLocal(context);
3537 } 3730 }
3538 3731
3539 3732
3540 v8::Local<v8::Context> Context::GetCalling() { 3733 v8::Local<v8::Context> Context::GetCalling() {
3541 if (IsDeadCheck("v8::Context::GetCalling()")) return Local<Context>(); 3734 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::GetCalling()")) {
3735 return Local<Context>();
3736 }
3542 i::Handle<i::Object> calling = 3737 i::Handle<i::Object> calling =
3543 i::Isolate::Current()->GetCallingGlobalContext(); 3738 i::Isolate::Current()->GetCallingGlobalContext();
3544 if (calling.is_null()) return Local<Context>(); 3739 if (calling.is_null()) return Local<Context>();
3545 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling); 3740 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling);
3546 return Utils::ToLocal(context); 3741 return Utils::ToLocal(context);
3547 } 3742 }
3548 3743
3549 3744
3550 v8::Local<v8::Object> Context::Global() { 3745 v8::Local<v8::Object> Context::Global() {
3551 if (IsDeadCheck("v8::Context::Global()")) return Local<v8::Object>(); 3746 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
3747 return Local<v8::Object>();
3748 }
3552 i::Object** ctx = reinterpret_cast<i::Object**>(this); 3749 i::Object** ctx = reinterpret_cast<i::Object**>(this);
3553 i::Handle<i::Context> context = 3750 i::Handle<i::Context> context =
3554 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); 3751 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
3555 i::Handle<i::Object> global(context->global_proxy()); 3752 i::Handle<i::Object> global(context->global_proxy());
3556 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global)); 3753 return Utils::ToLocal(i::Handle<i::JSObject>::cast(global));
3557 } 3754 }
3558 3755
3559 3756
3560 void Context::DetachGlobal() { 3757 void Context::DetachGlobal() {
3561 if (IsDeadCheck("v8::Context::DetachGlobal()")) return; 3758 if (IsDeadCheck(i::Isolate::Current(), "v8::Context::DetachGlobal()")) return;
3562 ENTER_V8; 3759 ENTER_V8;
3563 i::Object** ctx = reinterpret_cast<i::Object**>(this); 3760 i::Object** ctx = reinterpret_cast<i::Object**>(this);
3564 i::Handle<i::Context> context = 3761 i::Handle<i::Context> context =
3565 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); 3762 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
3566 i::Isolate::Current()->bootstrapper()->DetachGlobal(context); 3763 i::Isolate::Current()->bootstrapper()->DetachGlobal(context);
3567 } 3764 }
3568 3765
3569 3766
3570 void Context::ReattachGlobal(Handle<Object> global_object) { 3767 void Context::ReattachGlobal(Handle<Object> global_object) {
3571 if (IsDeadCheck("v8::Context::ReattachGlobal()")) return; 3768 i::Isolate* isolate = i::Isolate::Current();
3769 if (IsDeadCheck(isolate, "v8::Context::ReattachGlobal()")) return;
3572 ENTER_V8; 3770 ENTER_V8;
3573 i::Object** ctx = reinterpret_cast<i::Object**>(this); 3771 i::Object** ctx = reinterpret_cast<i::Object**>(this);
3574 i::Handle<i::Context> context = 3772 i::Handle<i::Context> context =
3575 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); 3773 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx));
3576 i::Isolate::Current()->bootstrapper()->ReattachGlobal( 3774 isolate->bootstrapper()->ReattachGlobal(
3577 context, 3775 context,
3578 Utils::OpenHandle(*global_object)); 3776 Utils::OpenHandle(*global_object));
3579 } 3777 }
3580 3778
3581 3779
3582 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) { 3780 void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) {
3583 i::GlobalHandles::SetWrapperClassId(global_handle, class_id); 3781 i::GlobalHandles::SetWrapperClassId(global_handle, class_id);
3584 } 3782 }
3585 3783
3586 3784
3587 Local<v8::Object> ObjectTemplate::NewInstance() { 3785 Local<v8::Object> ObjectTemplate::NewInstance() {
3588 ON_BAILOUT("v8::ObjectTemplate::NewInstance()", return Local<v8::Object>()); 3786 i::Isolate* isolate = i::Isolate::Current();
3589 LOG_API("ObjectTemplate::NewInstance"); 3787 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()",
3788 return Local<v8::Object>());
3789 LOG_API(isolate, "ObjectTemplate::NewInstance");
3590 ENTER_V8; 3790 ENTER_V8;
3591 EXCEPTION_PREAMBLE(); 3791 EXCEPTION_PREAMBLE();
3592 i::Handle<i::Object> obj = 3792 i::Handle<i::Object> obj =
3593 i::Execution::InstantiateObject(Utils::OpenHandle(this), 3793 i::Execution::InstantiateObject(Utils::OpenHandle(this),
3594 &has_pending_exception); 3794 &has_pending_exception);
3595 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>()); 3795 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
3596 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); 3796 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj));
3597 } 3797 }
3598 3798
3599 3799
3600 Local<v8::Function> FunctionTemplate::GetFunction() { 3800 Local<v8::Function> FunctionTemplate::GetFunction() {
3601 ON_BAILOUT("v8::FunctionTemplate::GetFunction()", 3801 i::Isolate* isolate = i::Isolate::Current();
3802 ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()",
3602 return Local<v8::Function>()); 3803 return Local<v8::Function>());
3603 LOG_API("FunctionTemplate::GetFunction"); 3804 LOG_API(isolate, "FunctionTemplate::GetFunction");
3604 ENTER_V8; 3805 ENTER_V8;
3605 EXCEPTION_PREAMBLE(); 3806 EXCEPTION_PREAMBLE();
3606 i::Handle<i::Object> obj = 3807 i::Handle<i::Object> obj =
3607 i::Execution::InstantiateFunction(Utils::OpenHandle(this), 3808 i::Execution::InstantiateFunction(Utils::OpenHandle(this),
3608 &has_pending_exception); 3809 &has_pending_exception);
3609 EXCEPTION_BAILOUT_CHECK(Local<v8::Function>()); 3810 EXCEPTION_BAILOUT_CHECK(Local<v8::Function>());
3610 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); 3811 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj));
3611 } 3812 }
3612 3813
3613 3814
3614 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { 3815 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) {
3615 ON_BAILOUT("v8::FunctionTemplate::HasInstanceOf()", return false); 3816 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()",
3817 return false);
3616 i::Object* obj = *Utils::OpenHandle(*value); 3818 i::Object* obj = *Utils::OpenHandle(*value);
3617 return obj->IsInstanceOf(*Utils::OpenHandle(this)); 3819 return obj->IsInstanceOf(*Utils::OpenHandle(this));
3618 } 3820 }
3619 3821
3620 3822
3621 static Local<External> ExternalNewImpl(void* data) { 3823 static Local<External> ExternalNewImpl(void* data) {
3622 return Utils::ToLocal(FACTORY->NewProxy(static_cast<i::Address>(data))); 3824 return Utils::ToLocal(FACTORY->NewProxy(static_cast<i::Address>(data)));
3623 } 3825 }
3624 3826
3625 static void* ExternalValueImpl(i::Handle<i::Object> obj) { 3827 static void* ExternalValueImpl(i::Handle<i::Object> obj) {
3626 return reinterpret_cast<void*>(i::Proxy::cast(*obj)->proxy()); 3828 return reinterpret_cast<void*>(i::Proxy::cast(*obj)->proxy());
3627 } 3829 }
3628 3830
3629 3831
3630 Local<Value> v8::External::Wrap(void* data) { 3832 Local<Value> v8::External::Wrap(void* data) {
3833 i::Isolate* isolate = i::Isolate::Current();
3631 STATIC_ASSERT(sizeof(data) == sizeof(i::Address)); 3834 STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
3632 LOG_API("External::Wrap"); 3835 LOG_API(isolate, "External::Wrap");
3633 EnsureInitialized("v8::External::Wrap()"); 3836 EnsureInitializedForIsolate(isolate, "v8::External::Wrap()");
3634 ENTER_V8; 3837 ENTER_V8;
3635 3838
3636 v8::Local<v8::Value> result = CanBeEncodedAsSmi(data) 3839 v8::Local<v8::Value> result = CanBeEncodedAsSmi(data)
3637 ? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data))) 3840 ? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data)))
3638 : v8::Local<v8::Value>(ExternalNewImpl(data)); 3841 : v8::Local<v8::Value>(ExternalNewImpl(data));
3639 3842
3640 ASSERT_EQ(data, Unwrap(result)); 3843 ASSERT_EQ(data, Unwrap(result));
3641 return result; 3844 return result;
3642 } 3845 }
3643 3846
3644 3847
3645 void* v8::Object::SlowGetPointerFromInternalField(int index) { 3848 void* v8::Object::SlowGetPointerFromInternalField(int index) {
3646 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); 3849 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3647 i::Object* value = obj->GetInternalField(index); 3850 i::Object* value = obj->GetInternalField(index);
3648 if (value->IsSmi()) { 3851 if (value->IsSmi()) {
3649 return i::Internals::GetExternalPointerFromSmi(value); 3852 return i::Internals::GetExternalPointerFromSmi(value);
3650 } else if (value->IsProxy()) { 3853 } else if (value->IsProxy()) {
3651 return reinterpret_cast<void*>(i::Proxy::cast(value)->proxy()); 3854 return reinterpret_cast<void*>(i::Proxy::cast(value)->proxy());
3652 } else { 3855 } else {
3653 return NULL; 3856 return NULL;
3654 } 3857 }
3655 } 3858 }
3656 3859
3657 3860
3658 void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) { 3861 void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) {
3659 if (IsDeadCheck("v8::External::Unwrap()")) return 0; 3862 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Unwrap()")) return 0;
3660 i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper); 3863 i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper);
3661 void* result; 3864 void* result;
3662 if (obj->IsSmi()) { 3865 if (obj->IsSmi()) {
3663 result = i::Internals::GetExternalPointerFromSmi(*obj); 3866 result = i::Internals::GetExternalPointerFromSmi(*obj);
3664 } else if (obj->IsProxy()) { 3867 } else if (obj->IsProxy()) {
3665 result = ExternalValueImpl(obj); 3868 result = ExternalValueImpl(obj);
3666 } else { 3869 } else {
3667 result = NULL; 3870 result = NULL;
3668 } 3871 }
3669 ASSERT_EQ(result, QuickUnwrap(wrapper)); 3872 ASSERT_EQ(result, QuickUnwrap(wrapper));
3670 return result; 3873 return result;
3671 } 3874 }
3672 3875
3673 3876
3674 Local<External> v8::External::New(void* data) { 3877 Local<External> v8::External::New(void* data) {
3675 STATIC_ASSERT(sizeof(data) == sizeof(i::Address)); 3878 STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
3676 LOG_API("External::New"); 3879 i::Isolate* isolate = i::Isolate::Current();
3677 EnsureInitialized("v8::External::New()"); 3880 LOG_API(isolate, "External::New");
3881 EnsureInitializedForIsolate(isolate, "v8::External::New()");
3678 ENTER_V8; 3882 ENTER_V8;
3679 return ExternalNewImpl(data); 3883 return ExternalNewImpl(data);
3680 } 3884 }
3681 3885
3682 3886
3683 void* External::Value() const { 3887 void* External::Value() const {
3684 if (IsDeadCheck("v8::External::Value()")) return 0; 3888 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Value()")) return 0;
3685 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3889 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3686 return ExternalValueImpl(obj); 3890 return ExternalValueImpl(obj);
3687 } 3891 }
3688 3892
3689 3893
3690 Local<String> v8::String::Empty() { 3894 Local<String> v8::String::Empty() {
3691 EnsureInitialized("v8::String::Empty()"); 3895 i::Isolate* isolate = i::Isolate::Current();
3692 LOG_API("String::Empty()"); 3896 EnsureInitializedForIsolate(isolate, "v8::String::Empty()");
3693 return Utils::ToLocal(FACTORY->empty_symbol()); 3897 LOG_API(isolate, "String::Empty()");
3898 return Utils::ToLocal(isolate->factory()->empty_symbol());
3694 } 3899 }
3695 3900
3696 3901
3697 Local<String> v8::String::New(const char* data, int length) { 3902 Local<String> v8::String::New(const char* data, int length) {
3698 EnsureInitialized("v8::String::New()"); 3903 i::Isolate* isolate = i::Isolate::Current();
3699 LOG_API("String::New(char)"); 3904 EnsureInitializedForIsolate(isolate, "v8::String::New()");
3905 LOG_API(isolate, "String::New(char)");
3700 if (length == 0) return Empty(); 3906 if (length == 0) return Empty();
3701 ENTER_V8; 3907 ENTER_V8;
3702 if (length == -1) length = i::StrLength(data); 3908 if (length == -1) length = i::StrLength(data);
3703 i::Handle<i::String> result = 3909 i::Handle<i::String> result =
3704 FACTORY->NewStringFromUtf8(i::Vector<const char>(data, length)); 3910 isolate->factory()->NewStringFromUtf8(
3911 i::Vector<const char>(data, length));
3705 return Utils::ToLocal(result); 3912 return Utils::ToLocal(result);
3706 } 3913 }
3707 3914
3708 3915
3709 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { 3916 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
3710 EnsureInitialized("v8::String::New()"); 3917 i::Isolate* isolate = i::Isolate::Current();
3711 LOG_API("String::New(char)"); 3918 EnsureInitializedForIsolate(isolate, "v8::String::New()");
3919 LOG_API(isolate, "String::New(char)");
3712 ENTER_V8; 3920 ENTER_V8;
3713 i::Handle<i::String> left_string = Utils::OpenHandle(*left); 3921 i::Handle<i::String> left_string = Utils::OpenHandle(*left);
3714 i::Handle<i::String> right_string = Utils::OpenHandle(*right); 3922 i::Handle<i::String> right_string = Utils::OpenHandle(*right);
3715 i::Handle<i::String> result = FACTORY->NewConsString(left_string, 3923 i::Handle<i::String> result = FACTORY->NewConsString(left_string,
3716 right_string); 3924 right_string);
3717 return Utils::ToLocal(result); 3925 return Utils::ToLocal(result);
3718 } 3926 }
3719 3927
3720 3928
3721 Local<String> v8::String::NewUndetectable(const char* data, int length) { 3929 Local<String> v8::String::NewUndetectable(const char* data, int length) {
3722 EnsureInitialized("v8::String::NewUndetectable()"); 3930 i::Isolate* isolate = i::Isolate::Current();
3723 LOG_API("String::NewUndetectable(char)"); 3931 EnsureInitializedForIsolate(isolate, "v8::String::NewUndetectable()");
3932 LOG_API(isolate, "String::NewUndetectable(char)");
3724 ENTER_V8; 3933 ENTER_V8;
3725 if (length == -1) length = i::StrLength(data); 3934 if (length == -1) length = i::StrLength(data);
3726 i::Handle<i::String> result = 3935 i::Handle<i::String> result =
3727 FACTORY->NewStringFromUtf8(i::Vector<const char>(data, length)); 3936 FACTORY->NewStringFromUtf8(i::Vector<const char>(data, length));
3728 result->MarkAsUndetectable(); 3937 result->MarkAsUndetectable();
3729 return Utils::ToLocal(result); 3938 return Utils::ToLocal(result);
3730 } 3939 }
3731 3940
3732 3941
3733 static int TwoByteStringLength(const uint16_t* data) { 3942 static int TwoByteStringLength(const uint16_t* data) {
3734 int length = 0; 3943 int length = 0;
3735 while (data[length] != '\0') length++; 3944 while (data[length] != '\0') length++;
3736 return length; 3945 return length;
3737 } 3946 }
3738 3947
3739 3948
3740 Local<String> v8::String::New(const uint16_t* data, int length) { 3949 Local<String> v8::String::New(const uint16_t* data, int length) {
3741 EnsureInitialized("v8::String::New()"); 3950 i::Isolate* isolate = i::Isolate::Current();
3742 LOG_API("String::New(uint16_)"); 3951 EnsureInitializedForIsolate(isolate, "v8::String::New()");
3952 LOG_API(isolate, "String::New(uint16_)");
3743 if (length == 0) return Empty(); 3953 if (length == 0) return Empty();
3744 ENTER_V8; 3954 ENTER_V8;
3745 if (length == -1) length = TwoByteStringLength(data); 3955 if (length == -1) length = TwoByteStringLength(data);
3746 i::Handle<i::String> result = 3956 i::Handle<i::String> result =
3747 FACTORY->NewStringFromTwoByte(i::Vector<const uint16_t>(data, length)); 3957 isolate->factory()->NewStringFromTwoByte(
3958 i::Vector<const uint16_t>(data, length));
3748 return Utils::ToLocal(result); 3959 return Utils::ToLocal(result);
3749 } 3960 }
3750 3961
3751 3962
3752 Local<String> v8::String::NewUndetectable(const uint16_t* data, int length) { 3963 Local<String> v8::String::NewUndetectable(const uint16_t* data, int length) {
3753 EnsureInitialized("v8::String::NewUndetectable()"); 3964 i::Isolate* isolate = i::Isolate::Current();
3754 LOG_API("String::NewUndetectable(uint16_)"); 3965 EnsureInitializedForIsolate(isolate, "v8::String::NewUndetectable()");
3966 LOG_API(isolate, "String::NewUndetectable(uint16_)");
3755 ENTER_V8; 3967 ENTER_V8;
3756 if (length == -1) length = TwoByteStringLength(data); 3968 if (length == -1) length = TwoByteStringLength(data);
3757 i::Handle<i::String> result = 3969 i::Handle<i::String> result =
3758 FACTORY->NewStringFromTwoByte(i::Vector<const uint16_t>(data, length)); 3970 isolate->factory()->NewStringFromTwoByte(
3971 i::Vector<const uint16_t>(data, length));
3759 result->MarkAsUndetectable(); 3972 result->MarkAsUndetectable();
3760 return Utils::ToLocal(result); 3973 return Utils::ToLocal(result);
3761 } 3974 }
3762 3975
3763 3976
3764 i::Handle<i::String> NewExternalStringHandle( 3977 i::Handle<i::String> NewExternalStringHandle(i::Isolate* isolate,
3765 v8::String::ExternalStringResource* resource) { 3978 v8::String::ExternalStringResource* resource) {
3766 i::Handle<i::String> result = 3979 i::Handle<i::String> result =
3767 FACTORY->NewExternalStringFromTwoByte(resource); 3980 isolate->factory()->NewExternalStringFromTwoByte(resource);
3768 return result; 3981 return result;
3769 } 3982 }
3770 3983
3771 3984
3772 i::Handle<i::String> NewExternalAsciiStringHandle( 3985 i::Handle<i::String> NewExternalAsciiStringHandle(i::Isolate* isolate,
3773 v8::String::ExternalAsciiStringResource* resource) { 3986 v8::String::ExternalAsciiStringResource* resource) {
3774 i::Handle<i::String> result = 3987 i::Handle<i::String> result =
3775 FACTORY->NewExternalStringFromAscii(resource); 3988 isolate->factory()->NewExternalStringFromAscii(resource);
3776 return result; 3989 return result;
3777 } 3990 }
3778 3991
3779 3992
3780 Local<String> v8::String::NewExternal( 3993 Local<String> v8::String::NewExternal(
3781 v8::String::ExternalStringResource* resource) { 3994 v8::String::ExternalStringResource* resource) {
3782 EnsureInitialized("v8::String::NewExternal()"); 3995 i::Isolate* isolate = i::Isolate::Current();
3783 LOG_API("String::NewExternal"); 3996 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
3997 LOG_API(isolate, "String::NewExternal");
3784 ENTER_V8; 3998 ENTER_V8;
3785 i::Handle<i::String> result = NewExternalStringHandle(resource); 3999 i::Handle<i::String> result = NewExternalStringHandle(isolate, resource);
3786 HEAP->external_string_table()->AddString(*result); 4000 isolate->heap()->external_string_table()->AddString(*result);
3787 return Utils::ToLocal(result); 4001 return Utils::ToLocal(result);
3788 } 4002 }
3789 4003
3790 4004
3791 bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) { 4005 bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
3792 if (IsDeadCheck("v8::String::MakeExternal()")) return false; 4006 i::Isolate* isolate = i::Isolate::Current();
4007 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
3793 if (this->IsExternal()) return false; // Already an external string. 4008 if (this->IsExternal()) return false; // Already an external string.
3794 ENTER_V8; 4009 ENTER_V8;
3795 i::Handle<i::String> obj = Utils::OpenHandle(this); 4010 i::Handle<i::String> obj = Utils::OpenHandle(this);
3796 if (i::Isolate::Current()->string_tracker()->IsFreshUnusedString(obj)) { 4011 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
3797 return false; 4012 return false;
3798 } 4013 }
3799 bool result = obj->MakeExternal(resource); 4014 bool result = obj->MakeExternal(resource);
3800 if (result && !obj->IsSymbol()) { 4015 if (result && !obj->IsSymbol()) {
3801 HEAP->external_string_table()->AddString(*obj); 4016 isolate->heap()->external_string_table()->AddString(*obj);
3802 } 4017 }
3803 return result; 4018 return result;
3804 } 4019 }
3805 4020
3806 4021
3807 Local<String> v8::String::NewExternal( 4022 Local<String> v8::String::NewExternal(
3808 v8::String::ExternalAsciiStringResource* resource) { 4023 v8::String::ExternalAsciiStringResource* resource) {
3809 EnsureInitialized("v8::String::NewExternal()"); 4024 i::Isolate* isolate = i::Isolate::Current();
3810 LOG_API("String::NewExternal"); 4025 EnsureInitializedForIsolate(isolate, "v8::String::NewExternal()");
4026 LOG_API(isolate, "String::NewExternal");
3811 ENTER_V8; 4027 ENTER_V8;
3812 i::Handle<i::String> result = NewExternalAsciiStringHandle(resource); 4028 i::Handle<i::String> result = NewExternalAsciiStringHandle(isolate, resource);
3813 HEAP->external_string_table()->AddString(*result); 4029 isolate->heap()->external_string_table()->AddString(*result);
3814 return Utils::ToLocal(result); 4030 return Utils::ToLocal(result);
3815 } 4031 }
3816 4032
3817 4033
3818 bool v8::String::MakeExternal( 4034 bool v8::String::MakeExternal(
3819 v8::String::ExternalAsciiStringResource* resource) { 4035 v8::String::ExternalAsciiStringResource* resource) {
3820 if (IsDeadCheck("v8::String::MakeExternal()")) return false; 4036 i::Isolate* isolate = i::Isolate::Current();
4037 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
3821 if (this->IsExternal()) return false; // Already an external string. 4038 if (this->IsExternal()) return false; // Already an external string.
3822 ENTER_V8; 4039 ENTER_V8;
3823 i::Handle<i::String> obj = Utils::OpenHandle(this); 4040 i::Handle<i::String> obj = Utils::OpenHandle(this);
3824 if (i::Isolate::Current()->string_tracker()->IsFreshUnusedString(obj)) { 4041 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
3825 return false; 4042 return false;
3826 } 4043 }
3827 bool result = obj->MakeExternal(resource); 4044 bool result = obj->MakeExternal(resource);
3828 if (result && !obj->IsSymbol()) { 4045 if (result && !obj->IsSymbol()) {
3829 HEAP->external_string_table()->AddString(*obj); 4046 isolate->heap()->external_string_table()->AddString(*obj);
3830 } 4047 }
3831 return result; 4048 return result;
3832 } 4049 }
3833 4050
3834 4051
3835 bool v8::String::CanMakeExternal() { 4052 bool v8::String::CanMakeExternal() {
3836 if (IsDeadCheck("v8::String::CanMakeExternal()")) return false; 4053 i::Isolate* isolate = i::Isolate::Current();
4054 if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false;
3837 i::Handle<i::String> obj = Utils::OpenHandle(this); 4055 i::Handle<i::String> obj = Utils::OpenHandle(this);
3838 if (i::Isolate::Current()->string_tracker()->IsFreshUnusedString(obj)) { 4056 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
3839 return false; 4057 return false;
3840 } 4058 }
3841 int size = obj->Size(); // Byte size of the original string. 4059 int size = obj->Size(); // Byte size of the original string.
3842 if (size < i::ExternalString::kSize) 4060 if (size < i::ExternalString::kSize)
3843 return false; 4061 return false;
3844 i::StringShape shape(*obj); 4062 i::StringShape shape(*obj);
3845 return !shape.IsExternal(); 4063 return !shape.IsExternal();
3846 } 4064 }
3847 4065
3848 4066
3849 Local<v8::Object> v8::Object::New() { 4067 Local<v8::Object> v8::Object::New() {
3850 EnsureInitialized("v8::Object::New()"); 4068 i::Isolate* isolate = i::Isolate::Current();
3851 LOG_API("Object::New"); 4069 EnsureInitializedForIsolate(isolate, "v8::Object::New()");
4070 LOG_API(isolate, "Object::New");
3852 ENTER_V8; 4071 ENTER_V8;
3853 i::Handle<i::JSObject> obj = 4072 i::Handle<i::JSObject> obj =
3854 FACTORY->NewJSObject(i::Isolate::Current()->object_function()); 4073 isolate->factory()->NewJSObject(i::Isolate::Current()->object_function());
3855 return Utils::ToLocal(obj); 4074 return Utils::ToLocal(obj);
3856 } 4075 }
3857 4076
3858 4077
3859 Local<v8::Value> v8::Date::New(double time) { 4078 Local<v8::Value> v8::Date::New(double time) {
3860 EnsureInitialized("v8::Date::New()"); 4079 i::Isolate* isolate = i::Isolate::Current();
3861 LOG_API("Date::New"); 4080 EnsureInitializedForIsolate(isolate, "v8::Date::New()");
4081 LOG_API(isolate, "Date::New");
3862 if (isnan(time)) { 4082 if (isnan(time)) {
3863 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. 4083 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
3864 time = i::OS::nan_value(); 4084 time = i::OS::nan_value();
3865 } 4085 }
3866 ENTER_V8; 4086 ENTER_V8;
3867 EXCEPTION_PREAMBLE(); 4087 EXCEPTION_PREAMBLE();
3868 i::Handle<i::Object> obj = 4088 i::Handle<i::Object> obj =
3869 i::Execution::NewDate(time, &has_pending_exception); 4089 i::Execution::NewDate(time, &has_pending_exception);
3870 EXCEPTION_BAILOUT_CHECK(Local<v8::Value>()); 4090 EXCEPTION_BAILOUT_CHECK(Local<v8::Value>());
3871 return Utils::ToLocal(obj); 4091 return Utils::ToLocal(obj);
3872 } 4092 }
3873 4093
3874 4094
3875 double v8::Date::NumberValue() const { 4095 double v8::Date::NumberValue() const {
3876 if (IsDeadCheck("v8::Date::NumberValue()")) return 0; 4096 i::Isolate* isolate = i::Isolate::Current();
3877 LOG_API("Date::NumberValue"); 4097 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0;
4098 LOG_API(isolate, "Date::NumberValue");
3878 i::Handle<i::Object> obj = Utils::OpenHandle(this); 4099 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3879 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); 4100 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
3880 return jsvalue->value()->Number(); 4101 return jsvalue->value()->Number();
3881 } 4102 }
3882 4103
3883 4104
3884 void v8::Date::DateTimeConfigurationChangeNotification() { 4105 void v8::Date::DateTimeConfigurationChangeNotification() {
3885 ON_BAILOUT("v8::Date::DateTimeConfigurationChangeNotification()", return); 4106 i::Isolate* isolate = i::Isolate::Current();
3886 LOG_API("Date::DateTimeConfigurationChangeNotification"); 4107 ON_BAILOUT(isolate, "v8::Date::DateTimeConfigurationChangeNotification()",
4108 return);
4109 LOG_API(isolate, "Date::DateTimeConfigurationChangeNotification");
3887 ENTER_V8; 4110 ENTER_V8;
3888 4111
3889 HandleScope scope; 4112 i::HandleScope scope(isolate);
3890 i::Isolate* isolate = i::Isolate::Current();
3891 // Get the function ResetDateCache (defined in date-delay.js). 4113 // Get the function ResetDateCache (defined in date-delay.js).
3892 i::Handle<i::String> func_name_str = 4114 i::Handle<i::String> func_name_str =
3893 isolate->factory()->LookupAsciiSymbol("ResetDateCache"); 4115 isolate->factory()->LookupAsciiSymbol("ResetDateCache");
3894 i::MaybeObject* result = 4116 i::MaybeObject* result =
3895 isolate->js_builtins_object()->GetProperty(*func_name_str); 4117 isolate->js_builtins_object()->GetProperty(*func_name_str);
3896 i::Object* object_func; 4118 i::Object* object_func;
3897 if (!result->ToObject(&object_func)) { 4119 if (!result->ToObject(&object_func)) {
3898 return; 4120 return;
3899 } 4121 }
3900 4122
(...skipping 17 matching lines...) Expand all
3918 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; 4140 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
3919 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; 4141 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
3920 ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf))); 4142 ASSERT(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
3921 return FACTORY->LookupSymbol( 4143 return FACTORY->LookupSymbol(
3922 i::Vector<const char>(flags_buf, num_flags)); 4144 i::Vector<const char>(flags_buf, num_flags));
3923 } 4145 }
3924 4146
3925 4147
3926 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern, 4148 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern,
3927 Flags flags) { 4149 Flags flags) {
3928 EnsureInitialized("v8::RegExp::New()"); 4150 i::Isolate* isolate = i::Isolate::Current();
3929 LOG_API("RegExp::New"); 4151 EnsureInitializedForIsolate(isolate, "v8::RegExp::New()");
4152 LOG_API(isolate, "RegExp::New");
3930 ENTER_V8; 4153 ENTER_V8;
3931 EXCEPTION_PREAMBLE(); 4154 EXCEPTION_PREAMBLE();
3932 i::Handle<i::JSRegExp> obj = i::Execution::NewJSRegExp( 4155 i::Handle<i::JSRegExp> obj = i::Execution::NewJSRegExp(
3933 Utils::OpenHandle(*pattern), 4156 Utils::OpenHandle(*pattern),
3934 RegExpFlagsToString(flags), 4157 RegExpFlagsToString(flags),
3935 &has_pending_exception); 4158 &has_pending_exception);
3936 EXCEPTION_BAILOUT_CHECK(Local<v8::RegExp>()); 4159 EXCEPTION_BAILOUT_CHECK(Local<v8::RegExp>());
3937 return Utils::ToLocal(i::Handle<i::JSRegExp>::cast(obj)); 4160 return Utils::ToLocal(i::Handle<i::JSRegExp>::cast(obj));
3938 } 4161 }
3939 4162
3940 4163
3941 Local<v8::String> v8::RegExp::GetSource() const { 4164 Local<v8::String> v8::RegExp::GetSource() const {
3942 if (IsDeadCheck("v8::RegExp::GetSource()")) return Local<v8::String>(); 4165 i::Isolate* isolate = i::Isolate::Current();
4166 if (IsDeadCheck(isolate, "v8::RegExp::GetSource()")) {
4167 return Local<v8::String>();
4168 }
3943 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); 4169 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this);
3944 return Utils::ToLocal(i::Handle<i::String>(obj->Pattern())); 4170 return Utils::ToLocal(i::Handle<i::String>(obj->Pattern()));
3945 } 4171 }
3946 4172
3947 4173
3948 // Assert that the static flags cast in GetFlags is valid. 4174 // Assert that the static flags cast in GetFlags is valid.
3949 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \ 4175 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \
3950 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \ 4176 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
3951 static_cast<int>(i::JSRegExp::internal_flag)) 4177 static_cast<int>(i::JSRegExp::internal_flag))
3952 REGEXP_FLAG_ASSERT_EQ(kNone, NONE); 4178 REGEXP_FLAG_ASSERT_EQ(kNone, NONE);
3953 REGEXP_FLAG_ASSERT_EQ(kGlobal, GLOBAL); 4179 REGEXP_FLAG_ASSERT_EQ(kGlobal, GLOBAL);
3954 REGEXP_FLAG_ASSERT_EQ(kIgnoreCase, IGNORE_CASE); 4180 REGEXP_FLAG_ASSERT_EQ(kIgnoreCase, IGNORE_CASE);
3955 REGEXP_FLAG_ASSERT_EQ(kMultiline, MULTILINE); 4181 REGEXP_FLAG_ASSERT_EQ(kMultiline, MULTILINE);
3956 #undef REGEXP_FLAG_ASSERT_EQ 4182 #undef REGEXP_FLAG_ASSERT_EQ
3957 4183
3958 v8::RegExp::Flags v8::RegExp::GetFlags() const { 4184 v8::RegExp::Flags v8::RegExp::GetFlags() const {
3959 if (IsDeadCheck("v8::RegExp::GetFlags()")) return v8::RegExp::kNone; 4185 if (IsDeadCheck(i::Isolate::Current(), "v8::RegExp::GetFlags()")) {
4186 return v8::RegExp::kNone;
4187 }
3960 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); 4188 i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this);
3961 return static_cast<RegExp::Flags>(obj->GetFlags().value()); 4189 return static_cast<RegExp::Flags>(obj->GetFlags().value());
3962 } 4190 }
3963 4191
3964 4192
3965 Local<v8::Array> v8::Array::New(int length) { 4193 Local<v8::Array> v8::Array::New(int length) {
3966 EnsureInitialized("v8::Array::New()"); 4194 i::Isolate* isolate = i::Isolate::Current();
3967 LOG_API("Array::New"); 4195 EnsureInitializedForIsolate(isolate, "v8::Array::New()");
4196 LOG_API(isolate, "Array::New");
3968 ENTER_V8; 4197 ENTER_V8;
3969 i::Handle<i::JSArray> obj = FACTORY->NewJSArray(length); 4198 i::Handle<i::JSArray> obj = FACTORY->NewJSArray(length);
3970 return Utils::ToLocal(obj); 4199 return Utils::ToLocal(obj);
3971 } 4200 }
3972 4201
3973 4202
3974 uint32_t v8::Array::Length() const { 4203 uint32_t v8::Array::Length() const {
3975 if (IsDeadCheck("v8::Array::Length()")) return 0; 4204 i::Isolate* isolate = i::Isolate::Current();
4205 if (IsDeadCheck(isolate, "v8::Array::Length()")) return 0;
3976 i::Handle<i::JSArray> obj = Utils::OpenHandle(this); 4206 i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
3977 i::Object* length = obj->length(); 4207 i::Object* length = obj->length();
3978 if (length->IsSmi()) { 4208 if (length->IsSmi()) {
3979 return i::Smi::cast(length)->value(); 4209 return i::Smi::cast(length)->value();
3980 } else { 4210 } else {
3981 return static_cast<uint32_t>(length->Number()); 4211 return static_cast<uint32_t>(length->Number());
3982 } 4212 }
3983 } 4213 }
3984 4214
3985 4215
3986 Local<Object> Array::CloneElementAt(uint32_t index) { 4216 Local<Object> Array::CloneElementAt(uint32_t index) {
3987 ON_BAILOUT("v8::Array::CloneElementAt()", return Local<Object>()); 4217 i::Isolate* isolate = i::Isolate::Current();
4218 ON_BAILOUT(isolate, "v8::Array::CloneElementAt()", return Local<Object>());
3988 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 4219 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3989 if (!self->HasFastElements()) { 4220 if (!self->HasFastElements()) {
3990 return Local<Object>(); 4221 return Local<Object>();
3991 } 4222 }
3992 i::FixedArray* elms = i::FixedArray::cast(self->elements()); 4223 i::FixedArray* elms = i::FixedArray::cast(self->elements());
3993 i::Object* paragon = elms->get(index); 4224 i::Object* paragon = elms->get(index);
3994 if (!paragon->IsJSObject()) { 4225 if (!paragon->IsJSObject()) {
3995 return Local<Object>(); 4226 return Local<Object>();
3996 } 4227 }
3997 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon)); 4228 i::Handle<i::JSObject> paragon_handle(i::JSObject::cast(paragon));
3998 EXCEPTION_PREAMBLE(); 4229 EXCEPTION_PREAMBLE();
3999 ENTER_V8; 4230 ENTER_V8;
4000 i::Handle<i::JSObject> result = i::Copy(paragon_handle); 4231 i::Handle<i::JSObject> result = i::Copy(paragon_handle);
4001 has_pending_exception = result.is_null(); 4232 has_pending_exception = result.is_null();
4002 EXCEPTION_BAILOUT_CHECK(Local<Object>()); 4233 EXCEPTION_BAILOUT_CHECK(Local<Object>());
4003 return Utils::ToLocal(result); 4234 return Utils::ToLocal(result);
4004 } 4235 }
4005 4236
4006 4237
4007 Local<String> v8::String::NewSymbol(const char* data, int length) { 4238 Local<String> v8::String::NewSymbol(const char* data, int length) {
4008 EnsureInitialized("v8::String::NewSymbol()"); 4239 i::Isolate* isolate = i::Isolate::Current();
4009 LOG_API("String::NewSymbol(char)"); 4240 EnsureInitializedForIsolate(isolate, "v8::String::NewSymbol()");
4241 LOG_API(isolate, "String::NewSymbol(char)");
4010 ENTER_V8; 4242 ENTER_V8;
4011 if (length == -1) length = i::StrLength(data); 4243 if (length == -1) length = i::StrLength(data);
4012 i::Handle<i::String> result = 4244 i::Handle<i::String> result =
4013 FACTORY->LookupSymbol(i::Vector<const char>(data, length)); 4245 FACTORY->LookupSymbol(i::Vector<const char>(data, length));
4014 return Utils::ToLocal(result); 4246 return Utils::ToLocal(result);
4015 } 4247 }
4016 4248
4017 4249
4018 Local<Number> v8::Number::New(double value) { 4250 Local<Number> v8::Number::New(double value) {
4019 EnsureInitialized("v8::Number::New()"); 4251 i::Isolate* isolate = i::Isolate::Current();
4252 EnsureInitializedForIsolate(isolate, "v8::Number::New()");
4020 if (isnan(value)) { 4253 if (isnan(value)) {
4021 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. 4254 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
4022 value = i::OS::nan_value(); 4255 value = i::OS::nan_value();
4023 } 4256 }
4024 ENTER_V8; 4257 ENTER_V8;
4025 i::Handle<i::Object> result = FACTORY->NewNumber(value); 4258 i::Handle<i::Object> result = isolate->factory()->NewNumber(value);
4026 return Utils::NumberToLocal(result); 4259 return Utils::NumberToLocal(result);
4027 } 4260 }
4028 4261
4029 4262
4030 Local<Integer> v8::Integer::New(int32_t value) { 4263 Local<Integer> v8::Integer::New(int32_t value) {
4031 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 4264 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
4032 EnsureInitializedForIsolate(isolate, "v8::Integer::New()"); 4265 EnsureInitializedForIsolate(isolate, "v8::Integer::New()");
4033 if (i::Smi::IsValid(value)) { 4266 if (i::Smi::IsValid(value)) {
4034 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value), 4267 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value),
4035 isolate)); 4268 isolate));
(...skipping 15 matching lines...) Expand all
4051 } 4284 }
4052 4285
4053 4286
4054 void V8::IgnoreOutOfMemoryException() { 4287 void V8::IgnoreOutOfMemoryException() {
4055 EnterIsolateIfNeeded()->handle_scope_implementer()->set_ignore_out_of_memory( 4288 EnterIsolateIfNeeded()->handle_scope_implementer()->set_ignore_out_of_memory(
4056 true); 4289 true);
4057 } 4290 }
4058 4291
4059 4292
4060 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) { 4293 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
4061 EnsureInitialized("v8::V8::AddMessageListener()"); 4294 i::Isolate* isolate = i::Isolate::Current();
4062 ON_BAILOUT("v8::V8::AddMessageListener()", return false); 4295 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
4296 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false);
4063 ENTER_V8; 4297 ENTER_V8;
4064 HandleScope scope; 4298 i::HandleScope scope(isolate);
4065 NeanderArray listeners(FACTORY->message_listeners()); 4299 NeanderArray listeners(isolate->factory()->message_listeners());
4066 NeanderObject obj(2); 4300 NeanderObject obj(2);
4067 obj.set(0, *FACTORY->NewProxy(FUNCTION_ADDR(that))); 4301 obj.set(0, *isolate->factory()->NewProxy(FUNCTION_ADDR(that)));
4068 obj.set(1, data.IsEmpty() ? 4302 obj.set(1, data.IsEmpty() ?
4069 HEAP->undefined_value() : 4303 HEAP->undefined_value() :
4070 *Utils::OpenHandle(*data)); 4304 *Utils::OpenHandle(*data));
4071 listeners.add(obj.value()); 4305 listeners.add(obj.value());
4072 return true; 4306 return true;
4073 } 4307 }
4074 4308
4075 4309
4076 void V8::RemoveMessageListeners(MessageCallback that) { 4310 void V8::RemoveMessageListeners(MessageCallback that) {
4077 EnsureInitialized("v8::V8::RemoveMessageListener()"); 4311 i::Isolate* isolate = i::Isolate::Current();
4078 ON_BAILOUT("v8::V8::RemoveMessageListeners()", return); 4312 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()");
4313 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return);
4079 ENTER_V8; 4314 ENTER_V8;
4080 HandleScope scope; 4315 i::HandleScope scope(isolate);
4081 NeanderArray listeners(FACTORY->message_listeners()); 4316 NeanderArray listeners(isolate->factory()->message_listeners());
4082 for (int i = 0; i < listeners.length(); i++) { 4317 for (int i = 0; i < listeners.length(); i++) {
4083 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones 4318 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
4084 4319
4085 NeanderObject listener(i::JSObject::cast(listeners.get(i))); 4320 NeanderObject listener(i::JSObject::cast(listeners.get(i)));
4086 i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0))); 4321 i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0)));
4087 if (callback_obj->proxy() == FUNCTION_ADDR(that)) { 4322 if (callback_obj->proxy() == FUNCTION_ADDR(that)) {
4088 listeners.set(i, HEAP->undefined_value()); 4323 listeners.set(i, HEAP->undefined_value());
4089 } 4324 }
4090 } 4325 }
4091 } 4326 }
4092 4327
4093 4328
4094 void V8::SetCaptureStackTraceForUncaughtExceptions( 4329 void V8::SetCaptureStackTraceForUncaughtExceptions(
4095 bool capture, 4330 bool capture,
4096 int frame_limit, 4331 int frame_limit,
4097 StackTrace::StackTraceOptions options) { 4332 StackTrace::StackTraceOptions options) {
4098 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions( 4333 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
4099 capture, 4334 capture,
4100 frame_limit, 4335 frame_limit,
4101 options); 4336 options);
4102 } 4337 }
4103 4338
4104 4339
4105 void V8::SetCounterFunction(CounterLookupCallback callback) { 4340 void V8::SetCounterFunction(CounterLookupCallback callback) {
4106 if (IsDeadCheck("v8::V8::SetCounterFunction()")) return; 4341 i::Isolate* isolate = i::Isolate::Current();
4107 i::Isolate::Current()->stats_table()->SetCounterFunction(callback); 4342 if (IsDeadCheck(isolate, "v8::V8::SetCounterFunction()")) return;
4343 isolate->stats_table()->SetCounterFunction(callback);
4108 } 4344 }
4109 4345
4110 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { 4346 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
4111 if (IsDeadCheck("v8::V8::SetCreateHistogramFunction()")) return; 4347 i::Isolate* isolate = i::Isolate::Current();
4112 i::Isolate::Current()->stats_table()->SetCreateHistogramFunction(callback); 4348 if (IsDeadCheck(isolate, "v8::V8::SetCreateHistogramFunction()")) return;
4349 isolate->stats_table()->SetCreateHistogramFunction(callback);
4113 } 4350 }
4114 4351
4115 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) { 4352 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
4116 if (IsDeadCheck("v8::V8::SetAddHistogramSampleFunction()")) return; 4353 i::Isolate* isolate = i::Isolate::Current();
4117 i::Isolate::Current()->stats_table()-> 4354 if (IsDeadCheck(isolate, "v8::V8::SetAddHistogramSampleFunction()")) return;
4355 isolate->stats_table()->
4118 SetAddHistogramSampleFunction(callback); 4356 SetAddHistogramSampleFunction(callback);
4119 } 4357 }
4120 4358
4121 void V8::EnableSlidingStateWindow() { 4359 void V8::EnableSlidingStateWindow() {
4122 if (IsDeadCheck("v8::V8::EnableSlidingStateWindow()")) return; 4360 i::Isolate* isolate = i::Isolate::Current();
4123 LOGGER->EnableSlidingStateWindow(); 4361 if (IsDeadCheck(isolate, "v8::V8::EnableSlidingStateWindow()")) return;
4362 isolate->logger()->EnableSlidingStateWindow();
4124 } 4363 }
4125 4364
4126 4365
4127 void V8::SetFailedAccessCheckCallbackFunction( 4366 void V8::SetFailedAccessCheckCallbackFunction(
4128 FailedAccessCheckCallback callback) { 4367 FailedAccessCheckCallback callback) {
4129 if (IsDeadCheck("v8::V8::SetFailedAccessCheckCallbackFunction()")) return; 4368 i::Isolate* isolate = i::Isolate::Current();
4130 i::Isolate::Current()->SetFailedAccessCheckCallback(callback); 4369 if (IsDeadCheck(isolate, "v8::V8::SetFailedAccessCheckCallbackFunction()")) {
4370 return;
4371 }
4372 isolate->SetFailedAccessCheckCallback(callback);
4131 } 4373 }
4132 4374
4133
4134 void V8::AddObjectGroup(Persistent<Value>* objects, 4375 void V8::AddObjectGroup(Persistent<Value>* objects,
4135 size_t length, 4376 size_t length,
4136 RetainedObjectInfo* info) { 4377 RetainedObjectInfo* info) {
4137 if (IsDeadCheck("v8::V8::AddObjectGroup()")) return; 4378 i::Isolate* isolate = i::Isolate::Current();
4379 if (IsDeadCheck(isolate, "v8::V8::AddObjectGroup()")) return;
4138 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**)); 4380 STATIC_ASSERT(sizeof(Persistent<Value>) == sizeof(i::Object**));
4139 i::Isolate::Current()->global_handles()->AddGroup( 4381 isolate->global_handles()->AddGroup(
4140 reinterpret_cast<i::Object***>(objects), length, info); 4382 reinterpret_cast<i::Object***>(objects), length, info);
4141 } 4383 }
4142 4384
4143 4385
4144 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { 4386 int V8::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) {
4145 if (IsDeadCheck("v8::V8::AdjustAmountOfExternalAllocatedMemory()")) return 0; 4387 i::Isolate* isolate = i::Isolate::Current();
4146 return HEAP->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); 4388 if (IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
4389 return 0;
4390 }
4391 return isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
4392 change_in_bytes);
4147 } 4393 }
4148 4394
4149 4395
4150 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { 4396 void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
4151 if (IsDeadCheck("v8::V8::SetGlobalGCPrologueCallback()")) return; 4397 i::Isolate* isolate = i::Isolate::Current();
4152 HEAP->SetGlobalGCPrologueCallback(callback); 4398 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
4399 isolate->heap()->SetGlobalGCPrologueCallback(callback);
4153 } 4400 }
4154 4401
4155 4402
4156 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { 4403 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
4157 if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return; 4404 i::Isolate* isolate = i::Isolate::Current();
4158 HEAP->SetGlobalGCEpilogueCallback(callback); 4405 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return;
4406 isolate->heap()->SetGlobalGCEpilogueCallback(callback);
4159 } 4407 }
4160 4408
4161 4409
4162 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) { 4410 void V8::AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type) {
4163 if (IsDeadCheck("v8::V8::AddGCPrologueCallback()")) return; 4411 i::Isolate* isolate = i::Isolate::Current();
4164 HEAP->AddGCPrologueCallback(callback, gc_type); 4412 if (IsDeadCheck(isolate, "v8::V8::AddGCPrologueCallback()")) return;
4413 isolate->heap()->AddGCPrologueCallback(callback, gc_type);
4165 } 4414 }
4166 4415
4167 4416
4168 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) { 4417 void V8::RemoveGCPrologueCallback(GCPrologueCallback callback) {
4169 if (IsDeadCheck("v8::V8::RemoveGCPrologueCallback()")) return; 4418 i::Isolate* isolate = i::Isolate::Current();
4170 HEAP->RemoveGCPrologueCallback(callback); 4419 if (IsDeadCheck(isolate, "v8::V8::RemoveGCPrologueCallback()")) return;
4420 isolate->heap()->RemoveGCPrologueCallback(callback);
4171 } 4421 }
4172 4422
4173 4423
4174 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) { 4424 void V8::AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type) {
4175 if (IsDeadCheck("v8::V8::AddGCEpilogueCallback()")) return; 4425 i::Isolate* isolate = i::Isolate::Current();
4176 HEAP->AddGCEpilogueCallback(callback, gc_type); 4426 if (IsDeadCheck(isolate, "v8::V8::AddGCEpilogueCallback()")) return;
4427 isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
4177 } 4428 }
4178 4429
4179 4430
4180 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) { 4431 void V8::RemoveGCEpilogueCallback(GCEpilogueCallback callback) {
4181 if (IsDeadCheck("v8::V8::RemoveGCEpilogueCallback()")) return; 4432 i::Isolate* isolate = i::Isolate::Current();
4182 HEAP->RemoveGCEpilogueCallback(callback); 4433 if (IsDeadCheck(isolate, "v8::V8::RemoveGCEpilogueCallback()")) return;
4434 isolate->heap()->RemoveGCEpilogueCallback(callback);
4183 } 4435 }
4184 4436
4185 4437
4186 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback, 4438 void V8::AddMemoryAllocationCallback(MemoryAllocationCallback callback,
4187 ObjectSpace space, 4439 ObjectSpace space,
4188 AllocationAction action) { 4440 AllocationAction action) {
4189 if (IsDeadCheck("v8::V8::AddMemoryAllocationCallback()")) return; 4441 i::Isolate* isolate = i::Isolate::Current();
4190 i::Isolate::Current()->memory_allocator()->AddMemoryAllocationCallback( 4442 if (IsDeadCheck(isolate, "v8::V8::AddMemoryAllocationCallback()")) return;
4443 isolate->memory_allocator()->AddMemoryAllocationCallback(
4191 callback, space, action); 4444 callback, space, action);
4192 } 4445 }
4193 4446
4194 4447
4195 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { 4448 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
4196 if (IsDeadCheck("v8::V8::RemoveMemoryAllocationCallback()")) return; 4449 i::Isolate* isolate = i::Isolate::Current();
4197 i::Isolate::Current()->memory_allocator()->RemoveMemoryAllocationCallback( 4450 if (IsDeadCheck(isolate, "v8::V8::RemoveMemoryAllocationCallback()")) return;
4451 isolate->memory_allocator()->RemoveMemoryAllocationCallback(
4198 callback); 4452 callback);
4199 } 4453 }
4200 4454
4201 4455
4202 void V8::PauseProfiler() { 4456 void V8::PauseProfiler() {
4203 #ifdef ENABLE_LOGGING_AND_PROFILING 4457 #ifdef ENABLE_LOGGING_AND_PROFILING
4204 PauseProfilerEx(PROFILER_MODULE_CPU); 4458 PauseProfilerEx(PROFILER_MODULE_CPU);
4205 #endif 4459 #endif
4206 } 4460 }
4207 4461
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
4420 str->Write(str_); 4674 str->Write(str_);
4421 } 4675 }
4422 } 4676 }
4423 4677
4424 4678
4425 String::Value::~Value() { 4679 String::Value::~Value() {
4426 i::DeleteArray(str_); 4680 i::DeleteArray(str_);
4427 } 4681 }
4428 4682
4429 Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) { 4683 Local<Value> Exception::RangeError(v8::Handle<v8::String> raw_message) {
4430 LOG_API("RangeError"); 4684 i::Isolate* isolate = i::Isolate::Current();
4431 ON_BAILOUT("v8::Exception::RangeError()", return Local<Value>()); 4685 LOG_API(isolate, "RangeError");
4686 ON_BAILOUT(isolate, "v8::Exception::RangeError()", return Local<Value>());
4432 ENTER_V8; 4687 ENTER_V8;
4433 i::Object* error; 4688 i::Object* error;
4434 { 4689 {
4435 HandleScope scope; 4690 i::HandleScope scope(isolate);
4436 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 4691 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
4437 i::Handle<i::Object> result = FACTORY->NewRangeError(message); 4692 i::Handle<i::Object> result = FACTORY->NewRangeError(message);
4438 error = *result; 4693 error = *result;
4439 } 4694 }
4440 i::Handle<i::Object> result(error); 4695 i::Handle<i::Object> result(error);
4441 return Utils::ToLocal(result); 4696 return Utils::ToLocal(result);
4442 } 4697 }
4443 4698
4444 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) { 4699 Local<Value> Exception::ReferenceError(v8::Handle<v8::String> raw_message) {
4445 LOG_API("ReferenceError"); 4700 i::Isolate* isolate = i::Isolate::Current();
4446 ON_BAILOUT("v8::Exception::ReferenceError()", return Local<Value>()); 4701 LOG_API(isolate, "ReferenceError");
4702 ON_BAILOUT(isolate, "v8::Exception::ReferenceError()", return Local<Value>());
4447 ENTER_V8; 4703 ENTER_V8;
4448 i::Object* error; 4704 i::Object* error;
4449 { 4705 {
4450 HandleScope scope; 4706 i::HandleScope scope(isolate);
4451 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 4707 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
4452 i::Handle<i::Object> result = FACTORY->NewReferenceError(message); 4708 i::Handle<i::Object> result = FACTORY->NewReferenceError(message);
4453 error = *result; 4709 error = *result;
4454 } 4710 }
4455 i::Handle<i::Object> result(error); 4711 i::Handle<i::Object> result(error);
4456 return Utils::ToLocal(result); 4712 return Utils::ToLocal(result);
4457 } 4713 }
4458 4714
4459 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) { 4715 Local<Value> Exception::SyntaxError(v8::Handle<v8::String> raw_message) {
4460 LOG_API("SyntaxError"); 4716 i::Isolate* isolate = i::Isolate::Current();
4461 ON_BAILOUT("v8::Exception::SyntaxError()", return Local<Value>()); 4717 LOG_API(isolate, "SyntaxError");
4718 ON_BAILOUT(isolate, "v8::Exception::SyntaxError()", return Local<Value>());
4462 ENTER_V8; 4719 ENTER_V8;
4463 i::Object* error; 4720 i::Object* error;
4464 { 4721 {
4465 HandleScope scope; 4722 i::HandleScope scope(isolate);
4466 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 4723 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
4467 i::Handle<i::Object> result = FACTORY->NewSyntaxError(message); 4724 i::Handle<i::Object> result = FACTORY->NewSyntaxError(message);
4468 error = *result; 4725 error = *result;
4469 } 4726 }
4470 i::Handle<i::Object> result(error); 4727 i::Handle<i::Object> result(error);
4471 return Utils::ToLocal(result); 4728 return Utils::ToLocal(result);
4472 } 4729 }
4473 4730
4474 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) { 4731 Local<Value> Exception::TypeError(v8::Handle<v8::String> raw_message) {
4475 LOG_API("TypeError"); 4732 i::Isolate* isolate = i::Isolate::Current();
4476 ON_BAILOUT("v8::Exception::TypeError()", return Local<Value>()); 4733 LOG_API(isolate, "TypeError");
4734 ON_BAILOUT(isolate, "v8::Exception::TypeError()", return Local<Value>());
4477 ENTER_V8; 4735 ENTER_V8;
4478 i::Object* error; 4736 i::Object* error;
4479 { 4737 {
4480 HandleScope scope; 4738 i::HandleScope scope(isolate);
4481 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 4739 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
4482 i::Handle<i::Object> result = FACTORY->NewTypeError(message); 4740 i::Handle<i::Object> result = FACTORY->NewTypeError(message);
4483 error = *result; 4741 error = *result;
4484 } 4742 }
4485 i::Handle<i::Object> result(error); 4743 i::Handle<i::Object> result(error);
4486 return Utils::ToLocal(result); 4744 return Utils::ToLocal(result);
4487 } 4745 }
4488 4746
4489 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) { 4747 Local<Value> Exception::Error(v8::Handle<v8::String> raw_message) {
4490 LOG_API("Error"); 4748 i::Isolate* isolate = i::Isolate::Current();
4491 ON_BAILOUT("v8::Exception::Error()", return Local<Value>()); 4749 LOG_API(isolate, "Error");
4750 ON_BAILOUT(isolate, "v8::Exception::Error()", return Local<Value>());
4492 ENTER_V8; 4751 ENTER_V8;
4493 i::Object* error; 4752 i::Object* error;
4494 { 4753 {
4495 HandleScope scope; 4754 i::HandleScope scope(isolate);
4496 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); 4755 i::Handle<i::String> message = Utils::OpenHandle(*raw_message);
4497 i::Handle<i::Object> result = FACTORY->NewError(message); 4756 i::Handle<i::Object> result = FACTORY->NewError(message);
4498 error = *result; 4757 error = *result;
4499 } 4758 }
4500 i::Handle<i::Object> result(error); 4759 i::Handle<i::Object> result(error);
4501 return Utils::ToLocal(result); 4760 return Utils::ToLocal(result);
4502 } 4761 }
4503 4762
4504 4763
4505 // --- D e b u g S u p p o r t --- 4764 // --- D e b u g S u p p o r t ---
4506 4765
4507 #ifdef ENABLE_DEBUGGER_SUPPORT 4766 #ifdef ENABLE_DEBUGGER_SUPPORT
4508 4767
4509 static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) { 4768 static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) {
4510 i::Isolate* isolate = i::Isolate::Current(); 4769 i::Isolate* isolate = i::Isolate::Current();
4511 if (isolate->debug_event_callback() != NULL) { 4770 if (isolate->debug_event_callback() != NULL) {
4512 isolate->debug_event_callback()(event_details.GetEvent(), 4771 isolate->debug_event_callback()(event_details.GetEvent(),
4513 event_details.GetExecutionState(), 4772 event_details.GetExecutionState(),
4514 event_details.GetEventData(), 4773 event_details.GetEventData(),
4515 event_details.GetCallbackData()); 4774 event_details.GetCallbackData());
4516 } 4775 }
4517 } 4776 }
4518 4777
4519 4778
4520 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) { 4779 bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
4521 EnsureInitialized("v8::Debug::SetDebugEventListener()"); 4780 i::Isolate* isolate = i::Isolate::Current();
4522 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); 4781 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener()");
4782 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
4523 ENTER_V8; 4783 ENTER_V8;
4524 4784
4525 i::Isolate* isolate = i::Isolate::Current();
4526
4527 isolate->set_debug_event_callback(that); 4785 isolate->set_debug_event_callback(that);
4528 4786
4529 HandleScope scope; 4787 i::HandleScope scope(isolate);
4530 i::Handle<i::Object> proxy = isolate->factory()->undefined_value(); 4788 i::Handle<i::Object> proxy = isolate->factory()->undefined_value();
4531 if (that != NULL) { 4789 if (that != NULL) {
4532 proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(EventCallbackWrapper)); 4790 proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(EventCallbackWrapper));
4533 } 4791 }
4534 isolate->debugger()->SetEventListener(proxy, Utils::OpenHandle(*data)); 4792 isolate->debugger()->SetEventListener(proxy, Utils::OpenHandle(*data));
4535 return true; 4793 return true;
4536 } 4794 }
4537 4795
4538 4796
4539 bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) { 4797 bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) {
4540 EnsureInitialized("v8::Debug::SetDebugEventListener2()"); 4798 i::Isolate* isolate = i::Isolate::Current();
4541 ON_BAILOUT("v8::Debug::SetDebugEventListener2()", return false); 4799 EnsureInitializedForIsolate(isolate, "v8::Debug::SetDebugEventListener2()");
4800 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener2()", return false);
4542 ENTER_V8; 4801 ENTER_V8;
4543 i::Isolate* isolate = i::Isolate::Current(); 4802 i::HandleScope scope(isolate);
4544 HandleScope scope;
4545 i::Handle<i::Object> proxy = isolate->factory()->undefined_value(); 4803 i::Handle<i::Object> proxy = isolate->factory()->undefined_value();
4546 if (that != NULL) { 4804 if (that != NULL) {
4547 proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(that)); 4805 proxy = isolate->factory()->NewProxy(FUNCTION_ADDR(that));
4548 } 4806 }
4549 i::Isolate::Current()->debugger()->SetEventListener(proxy, 4807 isolate->debugger()->SetEventListener(proxy,
4550 Utils::OpenHandle(*data)); 4808 Utils::OpenHandle(*data));
4551 return true; 4809 return true;
4552 } 4810 }
4553 4811
4554 4812
4555 bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that, 4813 bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
4556 Handle<Value> data) { 4814 Handle<Value> data) {
4557 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); 4815 i::Isolate* isolate = i::Isolate::Current();
4816 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
4558 ENTER_V8; 4817 ENTER_V8;
4559 i::Isolate::Current()->debugger()->SetEventListener(Utils::OpenHandle(*that), 4818 isolate->debugger()->SetEventListener(Utils::OpenHandle(*that),
4560 Utils::OpenHandle(*data)); 4819 Utils::OpenHandle(*data));
4561 return true; 4820 return true;
4562 } 4821 }
4563 4822
4564 4823
4565 void Debug::DebugBreak(Isolate* isolate) { 4824 void Debug::DebugBreak(Isolate* isolate) {
4566 // If no isolate is supplied, use the default isolate. 4825 // If no isolate is supplied, use the default isolate.
4567 if (isolate != NULL) { 4826 if (isolate != NULL) {
4568 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak(); 4827 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak();
4569 } else { 4828 } else {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 DebugMessageDispatchHandler handler, bool provide_locker) { 4908 DebugMessageDispatchHandler handler, bool provide_locker) {
4650 EnsureInitialized("v8::Debug::SetDebugMessageDispatchHandler"); 4909 EnsureInitialized("v8::Debug::SetDebugMessageDispatchHandler");
4651 ENTER_V8; 4910 ENTER_V8;
4652 i::Isolate::Current()->debugger()->SetDebugMessageDispatchHandler( 4911 i::Isolate::Current()->debugger()->SetDebugMessageDispatchHandler(
4653 handler, provide_locker); 4912 handler, provide_locker);
4654 } 4913 }
4655 4914
4656 4915
4657 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, 4916 Local<Value> Debug::Call(v8::Handle<v8::Function> fun,
4658 v8::Handle<v8::Value> data) { 4917 v8::Handle<v8::Value> data) {
4659 if (!i::Isolate::Current()->IsInitialized()) return Local<Value>(); 4918 i::Isolate* isolate = i::Isolate::Current();
4660 ON_BAILOUT("v8::Debug::Call()", return Local<Value>()); 4919 if (!isolate->IsInitialized()) return Local<Value>();
4920 ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>());
4661 ENTER_V8; 4921 ENTER_V8;
4662 i::Handle<i::Object> result; 4922 i::Handle<i::Object> result;
4663 EXCEPTION_PREAMBLE(); 4923 EXCEPTION_PREAMBLE();
4664 if (data.IsEmpty()) { 4924 if (data.IsEmpty()) {
4665 result = 4925 result =
4666 i::Isolate::Current()->debugger()->Call(Utils::OpenHandle(*fun), 4926 i::Isolate::Current()->debugger()->Call(Utils::OpenHandle(*fun),
4667 FACTORY->undefined_value(), 4927 FACTORY->undefined_value(),
4668 &has_pending_exception); 4928 &has_pending_exception);
4669 } else { 4929 } else {
4670 result = i::Isolate::Current()->debugger()->Call(Utils::OpenHandle(*fun), 4930 result = i::Isolate::Current()->debugger()->Call(Utils::OpenHandle(*fun),
4671 Utils::OpenHandle(*data), 4931 Utils::OpenHandle(*data),
4672 &has_pending_exception); 4932 &has_pending_exception);
4673 } 4933 }
4674 EXCEPTION_BAILOUT_CHECK(Local<Value>()); 4934 EXCEPTION_BAILOUT_CHECK(Local<Value>());
4675 return Utils::ToLocal(result); 4935 return Utils::ToLocal(result);
4676 } 4936 }
4677 4937
4678 4938
4679 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { 4939 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) {
4680 if (!i::Isolate::Current()->IsInitialized()) return Local<Value>(); 4940 i::Isolate* isolate = i::Isolate::Current();
4681 ON_BAILOUT("v8::Debug::GetMirror()", return Local<Value>()); 4941 if (!isolate->IsInitialized()) return Local<Value>();
4942 ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
4682 ENTER_V8; 4943 ENTER_V8;
4683 v8::HandleScope scope; 4944 v8::HandleScope scope;
4684 i::Debug* isolate_debug = i::Isolate::Current()->debug(); 4945 i::Debug* isolate_debug = i::Isolate::Current()->debug();
4685 isolate_debug->Load(); 4946 isolate_debug->Load();
4686 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global()); 4947 i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global());
4687 i::Handle<i::String> name = FACTORY->LookupAsciiSymbol("MakeMirror"); 4948 i::Handle<i::String> name = FACTORY->LookupAsciiSymbol("MakeMirror");
4688 i::Handle<i::Object> fun_obj = i::GetProperty(debug, name); 4949 i::Handle<i::Object> fun_obj = i::GetProperty(debug, name);
4689 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj); 4950 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(fun_obj);
4690 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun); 4951 v8::Handle<v8::Function> v8_fun = Utils::ToLocal(fun);
4691 const int kArgc = 1; 4952 const int kArgc = 1;
(...skipping 21 matching lines...) Expand all
4713 ENTER_V8; 4974 ENTER_V8;
4714 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); 4975 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
4715 } 4976 }
4716 4977
4717 #endif // ENABLE_DEBUGGER_SUPPORT 4978 #endif // ENABLE_DEBUGGER_SUPPORT
4718 4979
4719 4980
4720 #ifdef ENABLE_LOGGING_AND_PROFILING 4981 #ifdef ENABLE_LOGGING_AND_PROFILING
4721 4982
4722 Handle<String> CpuProfileNode::GetFunctionName() const { 4983 Handle<String> CpuProfileNode::GetFunctionName() const {
4723 IsDeadCheck("v8::CpuProfileNode::GetFunctionName"); 4984 i::Isolate* isolate = i::Isolate::Current();
4985 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName");
4724 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 4986 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
4725 const i::CodeEntry* entry = node->entry(); 4987 const i::CodeEntry* entry = node->entry();
4726 i::Isolate* isolate = i::Isolate::Current();
4727 if (!entry->has_name_prefix()) { 4988 if (!entry->has_name_prefix()) {
4728 return Handle<String>(ToApi<String>( 4989 return Handle<String>(ToApi<String>(
4729 isolate->factory()->LookupAsciiSymbol(entry->name()))); 4990 isolate->factory()->LookupAsciiSymbol(entry->name())));
4730 } else { 4991 } else {
4731 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString( 4992 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
4732 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()), 4993 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
4733 isolate->factory()->LookupAsciiSymbol(entry->name())))); 4994 isolate->factory()->LookupAsciiSymbol(entry->name()))));
4734 } 4995 }
4735 } 4996 }
4736 4997
4737 4998
4738 Handle<String> CpuProfileNode::GetScriptResourceName() const { 4999 Handle<String> CpuProfileNode::GetScriptResourceName() const {
4739 IsDeadCheck("v8::CpuProfileNode::GetScriptResourceName"); 5000 i::Isolate* isolate = i::Isolate::Current();
5001 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
4740 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 5002 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
4741 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol( 5003 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol(
4742 node->entry()->resource_name()))); 5004 node->entry()->resource_name())));
4743 } 5005 }
4744 5006
4745 5007
4746 int CpuProfileNode::GetLineNumber() const { 5008 int CpuProfileNode::GetLineNumber() const {
4747 IsDeadCheck("v8::CpuProfileNode::GetLineNumber"); 5009 i::Isolate* isolate = i::Isolate::Current();
5010 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber");
4748 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); 5011 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number();
4749 } 5012 }
4750 5013
4751 5014
4752 double CpuProfileNode::GetTotalTime() const { 5015 double CpuProfileNode::GetTotalTime() const {
4753 IsDeadCheck("v8::CpuProfileNode::GetTotalTime"); 5016 i::Isolate* isolate = i::Isolate::Current();
5017 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime");
4754 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); 5018 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis();
4755 } 5019 }
4756 5020
4757 5021
4758 double CpuProfileNode::GetSelfTime() const { 5022 double CpuProfileNode::GetSelfTime() const {
4759 IsDeadCheck("v8::CpuProfileNode::GetSelfTime"); 5023 i::Isolate* isolate = i::Isolate::Current();
5024 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime");
4760 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); 5025 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis();
4761 } 5026 }
4762 5027
4763 5028
4764 double CpuProfileNode::GetTotalSamplesCount() const { 5029 double CpuProfileNode::GetTotalSamplesCount() const {
4765 IsDeadCheck("v8::CpuProfileNode::GetTotalSamplesCount"); 5030 i::Isolate* isolate = i::Isolate::Current();
5031 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount");
4766 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); 5032 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks();
4767 } 5033 }
4768 5034
4769 5035
4770 double CpuProfileNode::GetSelfSamplesCount() const { 5036 double CpuProfileNode::GetSelfSamplesCount() const {
4771 IsDeadCheck("v8::CpuProfileNode::GetSelfSamplesCount"); 5037 i::Isolate* isolate = i::Isolate::Current();
5038 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount");
4772 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); 5039 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
4773 } 5040 }
4774 5041
4775 5042
4776 unsigned CpuProfileNode::GetCallUid() const { 5043 unsigned CpuProfileNode::GetCallUid() const {
4777 IsDeadCheck("v8::CpuProfileNode::GetCallUid"); 5044 i::Isolate* isolate = i::Isolate::Current();
5045 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid");
4778 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); 5046 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid();
4779 } 5047 }
4780 5048
4781 5049
4782 int CpuProfileNode::GetChildrenCount() const { 5050 int CpuProfileNode::GetChildrenCount() const {
4783 IsDeadCheck("v8::CpuProfileNode::GetChildrenCount"); 5051 i::Isolate* isolate = i::Isolate::Current();
5052 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount");
4784 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); 5053 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length();
4785 } 5054 }
4786 5055
4787 5056
4788 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { 5057 const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
4789 IsDeadCheck("v8::CpuProfileNode::GetChild"); 5058 i::Isolate* isolate = i::Isolate::Current();
5059 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
4790 const i::ProfileNode* child = 5060 const i::ProfileNode* child =
4791 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); 5061 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
4792 return reinterpret_cast<const CpuProfileNode*>(child); 5062 return reinterpret_cast<const CpuProfileNode*>(child);
4793 } 5063 }
4794 5064
4795 5065
4796 unsigned CpuProfile::GetUid() const { 5066 unsigned CpuProfile::GetUid() const {
4797 IsDeadCheck("v8::CpuProfile::GetUid"); 5067 i::Isolate* isolate = i::Isolate::Current();
5068 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
4798 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 5069 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
4799 } 5070 }
4800 5071
4801 5072
4802 Handle<String> CpuProfile::GetTitle() const { 5073 Handle<String> CpuProfile::GetTitle() const {
4803 IsDeadCheck("v8::CpuProfile::GetTitle"); 5074 i::Isolate* isolate = i::Isolate::Current();
5075 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
4804 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5076 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
4805 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol( 5077 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol(
4806 profile->title()))); 5078 profile->title())));
4807 } 5079 }
4808 5080
4809 5081
4810 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const { 5082 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const {
4811 IsDeadCheck("v8::CpuProfile::GetBottomUpRoot"); 5083 i::Isolate* isolate = i::Isolate::Current();
5084 IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot");
4812 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5085 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
4813 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root()); 5086 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root());
4814 } 5087 }
4815 5088
4816 5089
4817 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { 5090 const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
4818 IsDeadCheck("v8::CpuProfile::GetTopDownRoot"); 5091 i::Isolate* isolate = i::Isolate::Current();
5092 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
4819 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5093 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
4820 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); 5094 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
4821 } 5095 }
4822 5096
4823 5097
4824 int CpuProfiler::GetProfilesCount() { 5098 int CpuProfiler::GetProfilesCount() {
4825 IsDeadCheck("v8::CpuProfiler::GetProfilesCount"); 5099 i::Isolate* isolate = i::Isolate::Current();
5100 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
4826 return i::CpuProfiler::GetProfilesCount(); 5101 return i::CpuProfiler::GetProfilesCount();
4827 } 5102 }
4828 5103
4829 5104
4830 const CpuProfile* CpuProfiler::GetProfile(int index, 5105 const CpuProfile* CpuProfiler::GetProfile(int index,
4831 Handle<Value> security_token) { 5106 Handle<Value> security_token) {
4832 IsDeadCheck("v8::CpuProfiler::GetProfile"); 5107 i::Isolate* isolate = i::Isolate::Current();
5108 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
4833 return reinterpret_cast<const CpuProfile*>( 5109 return reinterpret_cast<const CpuProfile*>(
4834 i::CpuProfiler::GetProfile( 5110 i::CpuProfiler::GetProfile(
4835 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5111 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
4836 index)); 5112 index));
4837 } 5113 }
4838 5114
4839 5115
4840 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 5116 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
4841 Handle<Value> security_token) { 5117 Handle<Value> security_token) {
4842 IsDeadCheck("v8::CpuProfiler::FindProfile"); 5118 i::Isolate* isolate = i::Isolate::Current();
5119 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
4843 return reinterpret_cast<const CpuProfile*>( 5120 return reinterpret_cast<const CpuProfile*>(
4844 i::CpuProfiler::FindProfile( 5121 i::CpuProfiler::FindProfile(
4845 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5122 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
4846 uid)); 5123 uid));
4847 } 5124 }
4848 5125
4849 5126
4850 void CpuProfiler::StartProfiling(Handle<String> title) { 5127 void CpuProfiler::StartProfiling(Handle<String> title) {
4851 IsDeadCheck("v8::CpuProfiler::StartProfiling"); 5128 i::Isolate* isolate = i::Isolate::Current();
5129 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
4852 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title)); 5130 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title));
4853 } 5131 }
4854 5132
4855 5133
4856 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 5134 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
4857 Handle<Value> security_token) { 5135 Handle<Value> security_token) {
4858 IsDeadCheck("v8::CpuProfiler::StopProfiling"); 5136 i::Isolate* isolate = i::Isolate::Current();
5137 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
4859 return reinterpret_cast<const CpuProfile*>( 5138 return reinterpret_cast<const CpuProfile*>(
4860 i::CpuProfiler::StopProfiling( 5139 i::CpuProfiler::StopProfiling(
4861 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5140 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
4862 *Utils::OpenHandle(*title))); 5141 *Utils::OpenHandle(*title)));
4863 } 5142 }
4864 5143
4865 5144
4866 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 5145 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
4867 return const_cast<i::HeapGraphEdge*>( 5146 return const_cast<i::HeapGraphEdge*>(
4868 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 5147 reinterpret_cast<const i::HeapGraphEdge*>(edge));
4869 } 5148 }
4870 5149
4871 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 5150 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
4872 IsDeadCheck("v8::HeapGraphEdge::GetType"); 5151 i::Isolate* isolate = i::Isolate::Current();
5152 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
4873 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 5153 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
4874 } 5154 }
4875 5155
4876 5156
4877 Handle<Value> HeapGraphEdge::GetName() const { 5157 Handle<Value> HeapGraphEdge::GetName() const {
4878 IsDeadCheck("v8::HeapGraphEdge::GetName"); 5158 i::Isolate* isolate = i::Isolate::Current();
5159 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName");
4879 i::HeapGraphEdge* edge = ToInternal(this); 5160 i::HeapGraphEdge* edge = ToInternal(this);
4880 switch (edge->type()) { 5161 switch (edge->type()) {
4881 case i::HeapGraphEdge::kContextVariable: 5162 case i::HeapGraphEdge::kContextVariable:
4882 case i::HeapGraphEdge::kInternal: 5163 case i::HeapGraphEdge::kInternal:
4883 case i::HeapGraphEdge::kProperty: 5164 case i::HeapGraphEdge::kProperty:
4884 case i::HeapGraphEdge::kShortcut: 5165 case i::HeapGraphEdge::kShortcut:
4885 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol( 5166 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol(
4886 edge->name()))); 5167 edge->name())));
4887 case i::HeapGraphEdge::kElement: 5168 case i::HeapGraphEdge::kElement:
4888 case i::HeapGraphEdge::kHidden: 5169 case i::HeapGraphEdge::kHidden:
4889 return Handle<Number>(ToApi<Number>(FACTORY->NewNumberFromInt( 5170 return Handle<Number>(ToApi<Number>(FACTORY->NewNumberFromInt(
4890 edge->index()))); 5171 edge->index())));
4891 default: UNREACHABLE(); 5172 default: UNREACHABLE();
4892 } 5173 }
4893 return ImplementationUtilities::Undefined(); 5174 return ImplementationUtilities::Undefined();
4894 } 5175 }
4895 5176
4896 5177
4897 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { 5178 const HeapGraphNode* HeapGraphEdge::GetFromNode() const {
4898 IsDeadCheck("v8::HeapGraphEdge::GetFromNode"); 5179 i::Isolate* isolate = i::Isolate::Current();
5180 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode");
4899 const i::HeapEntry* from = ToInternal(this)->From(); 5181 const i::HeapEntry* from = ToInternal(this)->From();
4900 return reinterpret_cast<const HeapGraphNode*>(from); 5182 return reinterpret_cast<const HeapGraphNode*>(from);
4901 } 5183 }
4902 5184
4903 5185
4904 const HeapGraphNode* HeapGraphEdge::GetToNode() const { 5186 const HeapGraphNode* HeapGraphEdge::GetToNode() const {
4905 IsDeadCheck("v8::HeapGraphEdge::GetToNode"); 5187 i::Isolate* isolate = i::Isolate::Current();
5188 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode");
4906 const i::HeapEntry* to = ToInternal(this)->to(); 5189 const i::HeapEntry* to = ToInternal(this)->to();
4907 return reinterpret_cast<const HeapGraphNode*>(to); 5190 return reinterpret_cast<const HeapGraphNode*>(to);
4908 } 5191 }
4909 5192
4910 5193
4911 static i::HeapGraphPath* ToInternal(const HeapGraphPath* path) { 5194 static i::HeapGraphPath* ToInternal(const HeapGraphPath* path) {
4912 return const_cast<i::HeapGraphPath*>( 5195 return const_cast<i::HeapGraphPath*>(
4913 reinterpret_cast<const i::HeapGraphPath*>(path)); 5196 reinterpret_cast<const i::HeapGraphPath*>(path));
4914 } 5197 }
4915 5198
(...skipping 20 matching lines...) Expand all
4936 } 5219 }
4937 5220
4938 5221
4939 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { 5222 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) {
4940 return const_cast<i::HeapEntry*>( 5223 return const_cast<i::HeapEntry*>(
4941 reinterpret_cast<const i::HeapEntry*>(entry)); 5224 reinterpret_cast<const i::HeapEntry*>(entry));
4942 } 5225 }
4943 5226
4944 5227
4945 HeapGraphNode::Type HeapGraphNode::GetType() const { 5228 HeapGraphNode::Type HeapGraphNode::GetType() const {
4946 IsDeadCheck("v8::HeapGraphNode::GetType"); 5229 i::Isolate* isolate = i::Isolate::Current();
5230 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType");
4947 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); 5231 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type());
4948 } 5232 }
4949 5233
4950 5234
4951 Handle<String> HeapGraphNode::GetName() const { 5235 Handle<String> HeapGraphNode::GetName() const {
4952 IsDeadCheck("v8::HeapGraphNode::GetName"); 5236 i::Isolate* isolate = i::Isolate::Current();
5237 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
4953 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol( 5238 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol(
4954 ToInternal(this)->name()))); 5239 ToInternal(this)->name())));
4955 } 5240 }
4956 5241
4957 5242
4958 uint64_t HeapGraphNode::GetId() const { 5243 uint64_t HeapGraphNode::GetId() const {
4959 IsDeadCheck("v8::HeapGraphNode::GetId"); 5244 i::Isolate* isolate = i::Isolate::Current();
5245 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId");
4960 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); 5246 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated);
4961 return ToInternal(this)->id(); 5247 return ToInternal(this)->id();
4962 } 5248 }
4963 5249
4964 5250
4965 int HeapGraphNode::GetInstancesCount() const { 5251 int HeapGraphNode::GetInstancesCount() const {
4966 IsDeadCheck("v8::HeapGraphNode::GetInstancesCount"); 5252 i::Isolate* isolate = i::Isolate::Current();
5253 IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount");
4967 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); 5254 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated);
4968 return static_cast<int>(ToInternal(this)->id()); 5255 return static_cast<int>(ToInternal(this)->id());
4969 } 5256 }
4970 5257
4971 5258
4972 int HeapGraphNode::GetSelfSize() const { 5259 int HeapGraphNode::GetSelfSize() const {
4973 IsDeadCheck("v8::HeapGraphNode::GetSelfSize"); 5260 i::Isolate* isolate = i::Isolate::Current();
5261 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize");
4974 return ToInternal(this)->self_size(); 5262 return ToInternal(this)->self_size();
4975 } 5263 }
4976 5264
4977 5265
4978 int HeapGraphNode::GetRetainedSize(bool exact) const { 5266 int HeapGraphNode::GetRetainedSize(bool exact) const {
4979 IsDeadCheck("v8::HeapSnapshot::GetRetainedSize"); 5267 i::Isolate* isolate = i::Isolate::Current();
5268 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize");
4980 return ToInternal(this)->RetainedSize(exact); 5269 return ToInternal(this)->RetainedSize(exact);
4981 } 5270 }
4982 5271
4983 5272
4984 int HeapGraphNode::GetChildrenCount() const { 5273 int HeapGraphNode::GetChildrenCount() const {
4985 IsDeadCheck("v8::HeapSnapshot::GetChildrenCount"); 5274 i::Isolate* isolate = i::Isolate::Current();
5275 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount");
4986 return ToInternal(this)->children().length(); 5276 return ToInternal(this)->children().length();
4987 } 5277 }
4988 5278
4989 5279
4990 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { 5280 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const {
4991 IsDeadCheck("v8::HeapSnapshot::GetChild"); 5281 i::Isolate* isolate = i::Isolate::Current();
5282 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild");
4992 return reinterpret_cast<const HeapGraphEdge*>( 5283 return reinterpret_cast<const HeapGraphEdge*>(
4993 &ToInternal(this)->children()[index]); 5284 &ToInternal(this)->children()[index]);
4994 } 5285 }
4995 5286
4996 5287
4997 int HeapGraphNode::GetRetainersCount() const { 5288 int HeapGraphNode::GetRetainersCount() const {
4998 IsDeadCheck("v8::HeapSnapshot::GetRetainersCount"); 5289 i::Isolate* isolate = i::Isolate::Current();
5290 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount");
4999 return ToInternal(this)->retainers().length(); 5291 return ToInternal(this)->retainers().length();
5000 } 5292 }
5001 5293
5002 5294
5003 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { 5295 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const {
5004 IsDeadCheck("v8::HeapSnapshot::GetRetainer"); 5296 i::Isolate* isolate = i::Isolate::Current();
5297 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer");
5005 return reinterpret_cast<const HeapGraphEdge*>( 5298 return reinterpret_cast<const HeapGraphEdge*>(
5006 ToInternal(this)->retainers()[index]); 5299 ToInternal(this)->retainers()[index]);
5007 } 5300 }
5008 5301
5009 5302
5010 int HeapGraphNode::GetRetainingPathsCount() const { 5303 int HeapGraphNode::GetRetainingPathsCount() const {
5011 IsDeadCheck("v8::HeapSnapshot::GetRetainingPathsCount"); 5304 i::Isolate* isolate = i::Isolate::Current();
5305 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainingPathsCount");
5012 return ToInternal(this)->GetRetainingPaths()->length(); 5306 return ToInternal(this)->GetRetainingPaths()->length();
5013 } 5307 }
5014 5308
5015 5309
5016 const HeapGraphPath* HeapGraphNode::GetRetainingPath(int index) const { 5310 const HeapGraphPath* HeapGraphNode::GetRetainingPath(int index) const {
5017 IsDeadCheck("v8::HeapSnapshot::GetRetainingPath"); 5311 i::Isolate* isolate = i::Isolate::Current();
5312 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainingPath");
5018 return reinterpret_cast<const HeapGraphPath*>( 5313 return reinterpret_cast<const HeapGraphPath*>(
5019 ToInternal(this)->GetRetainingPaths()->at(index)); 5314 ToInternal(this)->GetRetainingPaths()->at(index));
5020 } 5315 }
5021 5316
5022 5317
5023 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { 5318 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const {
5024 IsDeadCheck("v8::HeapSnapshot::GetDominatorNode"); 5319 i::Isolate* isolate = i::Isolate::Current();
5320 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode");
5025 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); 5321 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator());
5026 } 5322 }
5027 5323
5028 5324
5029 const HeapGraphNode* HeapSnapshotsDiff::GetAdditionsRoot() const { 5325 const HeapGraphNode* HeapSnapshotsDiff::GetAdditionsRoot() const {
5030 IsDeadCheck("v8::HeapSnapshotsDiff::GetAdditionsRoot"); 5326 i::Isolate* isolate = i::Isolate::Current();
5327 IsDeadCheck(isolate, "v8::HeapSnapshotsDiff::GetAdditionsRoot");
5031 i::HeapSnapshotsDiff* diff = 5328 i::HeapSnapshotsDiff* diff =
5032 const_cast<i::HeapSnapshotsDiff*>( 5329 const_cast<i::HeapSnapshotsDiff*>(
5033 reinterpret_cast<const i::HeapSnapshotsDiff*>(this)); 5330 reinterpret_cast<const i::HeapSnapshotsDiff*>(this));
5034 return reinterpret_cast<const HeapGraphNode*>(diff->additions_root()); 5331 return reinterpret_cast<const HeapGraphNode*>(diff->additions_root());
5035 } 5332 }
5036 5333
5037 5334
5038 const HeapGraphNode* HeapSnapshotsDiff::GetDeletionsRoot() const { 5335 const HeapGraphNode* HeapSnapshotsDiff::GetDeletionsRoot() const {
5039 IsDeadCheck("v8::HeapSnapshotsDiff::GetDeletionsRoot"); 5336 i::Isolate* isolate = i::Isolate::Current();
5337 IsDeadCheck(isolate, "v8::HeapSnapshotsDiff::GetDeletionsRoot");
5040 i::HeapSnapshotsDiff* diff = 5338 i::HeapSnapshotsDiff* diff =
5041 const_cast<i::HeapSnapshotsDiff*>( 5339 const_cast<i::HeapSnapshotsDiff*>(
5042 reinterpret_cast<const i::HeapSnapshotsDiff*>(this)); 5340 reinterpret_cast<const i::HeapSnapshotsDiff*>(this));
5043 return reinterpret_cast<const HeapGraphNode*>(diff->deletions_root()); 5341 return reinterpret_cast<const HeapGraphNode*>(diff->deletions_root());
5044 } 5342 }
5045 5343
5046 5344
5047 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { 5345 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
5048 return const_cast<i::HeapSnapshot*>( 5346 return const_cast<i::HeapSnapshot*>(
5049 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); 5347 reinterpret_cast<const i::HeapSnapshot*>(snapshot));
5050 } 5348 }
5051 5349
5052 5350
5053 HeapSnapshot::Type HeapSnapshot::GetType() const { 5351 HeapSnapshot::Type HeapSnapshot::GetType() const {
5054 IsDeadCheck("v8::HeapSnapshot::GetType"); 5352 i::Isolate* isolate = i::Isolate::Current();
5353 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
5055 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); 5354 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
5056 } 5355 }
5057 5356
5058 5357
5059 unsigned HeapSnapshot::GetUid() const { 5358 unsigned HeapSnapshot::GetUid() const {
5060 IsDeadCheck("v8::HeapSnapshot::GetUid"); 5359 i::Isolate* isolate = i::Isolate::Current();
5360 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
5061 return ToInternal(this)->uid(); 5361 return ToInternal(this)->uid();
5062 } 5362 }
5063 5363
5064 5364
5065 Handle<String> HeapSnapshot::GetTitle() const { 5365 Handle<String> HeapSnapshot::GetTitle() const {
5066 IsDeadCheck("v8::HeapSnapshot::GetTitle"); 5366 i::Isolate* isolate = i::Isolate::Current();
5367 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
5067 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol( 5368 return Handle<String>(ToApi<String>(FACTORY->LookupAsciiSymbol(
5068 ToInternal(this)->title()))); 5369 ToInternal(this)->title())));
5069 } 5370 }
5070 5371
5071 5372
5072 const HeapGraphNode* HeapSnapshot::GetRoot() const { 5373 const HeapGraphNode* HeapSnapshot::GetRoot() const {
5073 IsDeadCheck("v8::HeapSnapshot::GetHead"); 5374 i::Isolate* isolate = i::Isolate::Current();
5375 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead");
5074 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); 5376 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
5075 } 5377 }
5076 5378
5077 5379
5078 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { 5380 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const {
5079 IsDeadCheck("v8::HeapSnapshot::GetNodeById"); 5381 i::Isolate* isolate = i::Isolate::Current();
5382 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById");
5080 return reinterpret_cast<const HeapGraphNode*>( 5383 return reinterpret_cast<const HeapGraphNode*>(
5081 ToInternal(this)->GetEntryById(id)); 5384 ToInternal(this)->GetEntryById(id));
5082 } 5385 }
5083 5386
5084 5387
5085 const HeapSnapshotsDiff* HeapSnapshot::CompareWith( 5388 const HeapSnapshotsDiff* HeapSnapshot::CompareWith(
5086 const HeapSnapshot* snapshot) const { 5389 const HeapSnapshot* snapshot) const {
5087 IsDeadCheck("v8::HeapSnapshot::CompareWith"); 5390 i::Isolate* isolate = i::Isolate::Current();
5391 IsDeadCheck(isolate, "v8::HeapSnapshot::CompareWith");
5088 return reinterpret_cast<const HeapSnapshotsDiff*>( 5392 return reinterpret_cast<const HeapSnapshotsDiff*>(
5089 ToInternal(this)->CompareWith(ToInternal(snapshot))); 5393 ToInternal(this)->CompareWith(ToInternal(snapshot)));
5090 } 5394 }
5091 5395
5092 5396
5093 void HeapSnapshot::Serialize(OutputStream* stream, 5397 void HeapSnapshot::Serialize(OutputStream* stream,
5094 HeapSnapshot::SerializationFormat format) const { 5398 HeapSnapshot::SerializationFormat format) const {
5095 IsDeadCheck("v8::HeapSnapshot::Serialize"); 5399 i::Isolate* isolate = i::Isolate::Current();
5400 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize");
5096 ApiCheck(format == kJSON, 5401 ApiCheck(format == kJSON,
5097 "v8::HeapSnapshot::Serialize", 5402 "v8::HeapSnapshot::Serialize",
5098 "Unknown serialization format"); 5403 "Unknown serialization format");
5099 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, 5404 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii,
5100 "v8::HeapSnapshot::Serialize", 5405 "v8::HeapSnapshot::Serialize",
5101 "Unsupported output encoding"); 5406 "Unsupported output encoding");
5102 ApiCheck(stream->GetChunkSize() > 0, 5407 ApiCheck(stream->GetChunkSize() > 0,
5103 "v8::HeapSnapshot::Serialize", 5408 "v8::HeapSnapshot::Serialize",
5104 "Invalid stream chunk size"); 5409 "Invalid stream chunk size");
5105 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); 5410 i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
5106 serializer.Serialize(stream); 5411 serializer.Serialize(stream);
5107 } 5412 }
5108 5413
5109 5414
5110 int HeapProfiler::GetSnapshotsCount() { 5415 int HeapProfiler::GetSnapshotsCount() {
5111 IsDeadCheck("v8::HeapProfiler::GetSnapshotsCount"); 5416 i::Isolate* isolate = i::Isolate::Current();
5417 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
5112 return i::HeapProfiler::GetSnapshotsCount(); 5418 return i::HeapProfiler::GetSnapshotsCount();
5113 } 5419 }
5114 5420
5115 5421
5116 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 5422 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
5117 IsDeadCheck("v8::HeapProfiler::GetSnapshot"); 5423 i::Isolate* isolate = i::Isolate::Current();
5424 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
5118 return reinterpret_cast<const HeapSnapshot*>( 5425 return reinterpret_cast<const HeapSnapshot*>(
5119 i::HeapProfiler::GetSnapshot(index)); 5426 i::HeapProfiler::GetSnapshot(index));
5120 } 5427 }
5121 5428
5122 5429
5123 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 5430 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
5124 IsDeadCheck("v8::HeapProfiler::FindSnapshot"); 5431 i::Isolate* isolate = i::Isolate::Current();
5432 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
5125 return reinterpret_cast<const HeapSnapshot*>( 5433 return reinterpret_cast<const HeapSnapshot*>(
5126 i::HeapProfiler::FindSnapshot(uid)); 5434 i::HeapProfiler::FindSnapshot(uid));
5127 } 5435 }
5128 5436
5129 5437
5130 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, 5438 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
5131 HeapSnapshot::Type type, 5439 HeapSnapshot::Type type,
5132 ActivityControl* control) { 5440 ActivityControl* control) {
5133 IsDeadCheck("v8::HeapProfiler::TakeSnapshot"); 5441 i::Isolate* isolate = i::Isolate::Current();
5442 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
5134 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; 5443 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
5135 switch (type) { 5444 switch (type) {
5136 case HeapSnapshot::kFull: 5445 case HeapSnapshot::kFull:
5137 internal_type = i::HeapSnapshot::kFull; 5446 internal_type = i::HeapSnapshot::kFull;
5138 break; 5447 break;
5139 case HeapSnapshot::kAggregated: 5448 case HeapSnapshot::kAggregated:
5140 internal_type = i::HeapSnapshot::kAggregated; 5449 internal_type = i::HeapSnapshot::kAggregated;
5141 break; 5450 break;
5142 default: 5451 default:
5143 UNREACHABLE(); 5452 UNREACHABLE();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
5285 5594
5286 5595
5287 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5596 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5288 HandleScopeImplementer* thread_local = 5597 HandleScopeImplementer* thread_local =
5289 reinterpret_cast<HandleScopeImplementer*>(storage); 5598 reinterpret_cast<HandleScopeImplementer*>(storage);
5290 thread_local->IterateThis(v); 5599 thread_local->IterateThis(v);
5291 return storage + ArchiveSpacePerThread(); 5600 return storage + ArchiveSpacePerThread();
5292 } 5601 }
5293 5602
5294 } } // namespace v8::internal 5603 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698