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

Side by Side Diff: src/api.cc

Issue 559993005: Move configuration of ResourceConstraints to Isolate construction (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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') | src/d8.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6646 matching lines...) Expand 10 before | Expand all | Expand 10 after
6657 6657
6658 6658
6659 Isolate* Isolate::GetCurrent() { 6659 Isolate* Isolate::GetCurrent() {
6660 i::Isolate* isolate = i::Isolate::Current(); 6660 i::Isolate* isolate = i::Isolate::Current();
6661 return reinterpret_cast<Isolate*>(isolate); 6661 return reinterpret_cast<Isolate*>(isolate);
6662 } 6662 }
6663 6663
6664 6664
6665 Isolate* Isolate::New(const Isolate::CreateParams& params) { 6665 Isolate* Isolate::New(const Isolate::CreateParams& params) {
6666 i::Isolate* isolate = new i::Isolate(); 6666 i::Isolate* isolate = new i::Isolate();
6667 Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
6667 if (params.entry_hook) { 6668 if (params.entry_hook) {
6668 isolate->set_function_entry_hook(params.entry_hook); 6669 isolate->set_function_entry_hook(params.entry_hook);
6669 } 6670 }
6670 if (params.code_event_handler) { 6671 if (params.code_event_handler) {
6671 isolate->InitializeLoggingAndCounters(); 6672 isolate->InitializeLoggingAndCounters();
6672 isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault, 6673 isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault,
6673 params.code_event_handler); 6674 params.code_event_handler);
6674 } 6675 }
6675 return reinterpret_cast<Isolate*>(isolate); 6676 SetResourceConstraints(v8_isolate,
6677 const_cast<ResourceConstraints*>(&params.constraints));
6678 return v8_isolate;
6676 } 6679 }
6677 6680
6678 6681
6679 void Isolate::Dispose() { 6682 void Isolate::Dispose() {
6680 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6683 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6681 if (!Utils::ApiCheck(!isolate->IsInUse(), 6684 if (!Utils::ApiCheck(!isolate->IsInUse(),
6682 "v8::Isolate::Dispose()", 6685 "v8::Isolate::Dispose()",
6683 "Disposing the isolate that is entered by a thread.")) { 6686 "Disposing the isolate that is entered by a thread.")) {
6684 return; 6687 return;
6685 } 6688 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
6882 6885
6883 void v8::Isolate::SetJitCodeEventHandler(JitCodeEventOptions options, 6886 void v8::Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
6884 JitCodeEventHandler event_handler) { 6887 JitCodeEventHandler event_handler) {
6885 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6888 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6886 // Ensure that logging is initialized for our isolate. 6889 // Ensure that logging is initialized for our isolate.
6887 isolate->InitializeLoggingAndCounters(); 6890 isolate->InitializeLoggingAndCounters();
6888 isolate->logger()->SetCodeEventHandler(options, event_handler); 6891 isolate->logger()->SetCodeEventHandler(options, event_handler);
6889 } 6892 }
6890 6893
6891 6894
6895 void v8::Isolate::SetStackLimit(uintptr_t stack_limit) {
6896 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6897 CHECK(stack_limit);
6898 isolate->stack_guard()->SetStackLimit(stack_limit);
6899 }
6900
6901
6892 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) 6902 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
6893 : str_(NULL), length_(0) { 6903 : str_(NULL), length_(0) {
6894 i::Isolate* isolate = i::Isolate::Current(); 6904 i::Isolate* isolate = i::Isolate::Current();
6895 if (obj.IsEmpty()) return; 6905 if (obj.IsEmpty()) return;
6896 ENTER_V8(isolate); 6906 ENTER_V8(isolate);
6897 i::HandleScope scope(isolate); 6907 i::HandleScope scope(isolate);
6898 TryCatch try_catch; 6908 TryCatch try_catch;
6899 Handle<String> str = obj->ToString(); 6909 Handle<String> str = obj->ToString();
6900 if (str.IsEmpty()) return; 6910 if (str.IsEmpty()) return;
6901 i::Handle<i::String> i_str = Utils::OpenHandle(*str); 6911 i::Handle<i::String> i_str = Utils::OpenHandle(*str);
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
7735 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7745 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7736 Address callback_address = 7746 Address callback_address =
7737 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7747 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7738 VMState<EXTERNAL> state(isolate); 7748 VMState<EXTERNAL> state(isolate);
7739 ExternalCallbackScope call_scope(isolate, callback_address); 7749 ExternalCallbackScope call_scope(isolate, callback_address);
7740 callback(info); 7750 callback(info);
7741 } 7751 }
7742 7752
7743 7753
7744 } } // namespace v8::internal 7754 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698