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

Side by Side Diff: src/api.cc

Issue 24550006: remove Local::New with no isolate parameter (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 2 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 | « include/v8.h ('k') | test/cctest/test-accessors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 int HandleScope::NumberOfHandles() { 677 int HandleScope::NumberOfHandles() {
678 i::Isolate* isolate = i::Isolate::Current(); 678 i::Isolate* isolate = i::Isolate::Current();
679 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) { 679 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) {
680 return 0; 680 return 0;
681 } 681 }
682 return i::HandleScope::NumberOfHandles(isolate); 682 return i::HandleScope::NumberOfHandles(isolate);
683 } 683 }
684 684
685 685
686 i::Object** HandleScope::CreateHandle(i::Object* value) {
687 return i::HandleScope::CreateHandle(i::Isolate::Current(), value);
688 }
689
690
691 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { 686 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) {
692 ASSERT(isolate == i::Isolate::Current());
693 return i::HandleScope::CreateHandle(isolate, value); 687 return i::HandleScope::CreateHandle(isolate, value);
694 } 688 }
695 689
696 690
697 i::Object** HandleScope::CreateHandle(i::HeapObject* value) { 691 i::Object** HandleScope::CreateHandle(i::HeapObject* heap_object,
698 ASSERT(value->IsHeapObject()); 692 i::Object* value) {
699 return reinterpret_cast<i::Object**>( 693 ASSERT(heap_object->IsHeapObject());
700 i::HandleScope::CreateHandle(value->GetIsolate(), value)); 694 return i::HandleScope::CreateHandle(heap_object->GetIsolate(), value);
701 } 695 }
702 696
703 697
704 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { 698 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) {
705 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 699 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
706 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value()); 700 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value());
707 Initialize(v8_isolate); 701 Initialize(v8_isolate);
708 } 702 }
709 703
710 704
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 rethrow_(false), 1922 rethrow_(false),
1929 has_terminated_(false) { 1923 has_terminated_(false) {
1930 Reset(); 1924 Reset();
1931 isolate_->RegisterTryCatchHandler(this); 1925 isolate_->RegisterTryCatchHandler(this);
1932 } 1926 }
1933 1927
1934 1928
1935 v8::TryCatch::~TryCatch() { 1929 v8::TryCatch::~TryCatch() {
1936 ASSERT(isolate_ == i::Isolate::Current()); 1930 ASSERT(isolate_ == i::Isolate::Current());
1937 if (rethrow_) { 1931 if (rethrow_) {
1938 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); 1932 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_);
1939 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); 1933 v8::HandleScope scope(isolate);
1934 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception());
1940 if (HasCaught() && capture_message_) { 1935 if (HasCaught() && capture_message_) {
1941 // If an exception was caught and rethrow_ is indicated, the saved 1936 // If an exception was caught and rethrow_ is indicated, the saved
1942 // message, script, and location need to be restored to Isolate TLS 1937 // message, script, and location need to be restored to Isolate TLS
1943 // for reuse. capture_message_ needs to be disabled so that DoThrow() 1938 // for reuse. capture_message_ needs to be disabled so that DoThrow()
1944 // does not create a new message. 1939 // does not create a new message.
1945 isolate_->thread_local_top()->rethrowing_message_ = true; 1940 isolate_->thread_local_top()->rethrowing_message_ = true;
1946 isolate_->RestorePendingMessageFromTryCatch(this); 1941 isolate_->RestorePendingMessageFromTryCatch(this);
1947 } 1942 }
1948 isolate_->UnregisterTryCatchHandler(this); 1943 isolate_->UnregisterTryCatchHandler(this);
1949 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); 1944 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc);
(...skipping 5630 matching lines...) Expand 10 before | Expand all | Expand 10 after
7580 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7575 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7581 Address callback_address = 7576 Address callback_address =
7582 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7577 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7583 VMState<EXTERNAL> state(isolate); 7578 VMState<EXTERNAL> state(isolate);
7584 ExternalCallbackScope call_scope(isolate, callback_address); 7579 ExternalCallbackScope call_scope(isolate, callback_address);
7585 callback(info); 7580 callback(info);
7586 } 7581 }
7587 7582
7588 7583
7589 } } // namespace v8::internal 7584 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698