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

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

Powered by Google App Engine
This is Rietveld 408576698