Reviewers: Sven Panne,
Description:
Add versions with an Isolate parameter for inlined API methods that need one
We shouldn't have APIs that call Isolate::GetCurrent() internally. This
change removes all remaining occurrences of inlined methods in v8.h
BUG=none
[email protected]
LOG=n
Please review this at https://codereview.chromium.org/85693002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+20, -7 lines):
M include/v8.h
M src/debug.cc
M test/cctest/test-api.cc
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
6e1ac3f5d1e828b0104cafff000e035964887e89..7f377c318e96ddea2a081182e5df45d6b73ca280
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1524,6 +1524,8 @@ class V8_EXPORT Primitive : public Value { };
class V8_EXPORT Boolean : public Primitive {
public:
bool Value() const;
+ V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value);
+ // Will be deprecated soon.
V8_INLINE static Handle<Boolean> New(bool value);
};
@@ -3094,6 +3096,8 @@ class V8_EXPORT Template : public Data {
/** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value,
PropertyAttribute attributes = None);
+ V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data>
value);
+ // Will be deprecated soon.
V8_INLINE void Set(const char* name, Handle<Data> value);
void SetAccessorProperty(
@@ -6031,14 +6035,23 @@ Handle<Boolean>
ScriptOrigin::ResourceIsSharedCrossOrigin() const {
}
-Handle<Boolean> Boolean::New(bool value) {
- Isolate* isolate = Isolate::GetCurrent();
+Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
return value ? True(isolate) : False(isolate);
}
+Handle<Boolean> Boolean::New(bool value) {
+ return Boolean::New(Isolate::GetCurrent(), value);
+}
+
+
+void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data>
value) {
+ Set(v8::String::NewFromUtf8(isolate, name), value);
+}
+
+
void Template::Set(const char* name, v8::Handle<Data> value) {
- Set(v8::String::NewFromUtf8(Isolate::GetCurrent(), name), value);
+ Set(Isolate::GetCurrent(), name, value);
}
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index
f3c3764121c0f9a34b29b9743f6dfb5f5af82e0f..23495c8e5c630862fdeb19216a6812afae7a4f30
100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -3137,7 +3137,7 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent
event,
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
- v8::Handle<v8::Boolean> running = v8::Boolean::New(auto_continue);
+ v8::Handle<v8::Boolean> running = v8::Boolean::New(isolate,
auto_continue);
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { running };
cmd_processor = v8::Local<v8::Object>::Cast(
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
0db63c1a164e33879c568253c0b19098e37fd6a2..23756db24e5957762f6b1fe8faa4063730385938
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -1631,7 +1631,7 @@ THREADED_TEST(PrimitiveAndWrappedBooleans) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- Local<Value> primitive_false = Boolean::New(false);
+ Local<Value> primitive_false = Boolean::New(env->GetIsolate(), false);
CHECK(primitive_false->IsBoolean());
CHECK(!primitive_false->IsBooleanObject());
CHECK(!primitive_false->BooleanValue());
@@ -1654,7 +1654,7 @@ THREADED_TEST(PrimitiveAndWrappedBooleans) {
CHECK(!false_boolean_object->IsTrue());
CHECK(!false_boolean_object->IsFalse());
- Local<Value> primitive_true = Boolean::New(true);
+ Local<Value> primitive_true = Boolean::New(env->GetIsolate(), true);
CHECK(primitive_true->IsBoolean());
CHECK(!primitive_true->IsBooleanObject());
CHECK(primitive_true->BooleanValue());
@@ -2625,7 +2625,7 @@ THREADED_TEST(EmbedderData) {
CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(env->GetIsolate(),
"over the lazy
dog."));
CheckEmbedderData(&env, 1, v8::Number::New(1.2345));
- CheckEmbedderData(&env, 0, v8::Boolean::New(true));
+ CheckEmbedderData(&env, 0, v8::Boolean::New(env->GetIsolate(), true));
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.