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

Unified Diff: src/api.cc

Issue 118523003: More API cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/d8-posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9c22cebe9590941b1b2ba273969a98983140cff5..4e14d795053cb45b608e5e6cbeb944c2ec410ff8 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -885,7 +885,7 @@ static void TemplateSet(i::Isolate* isolate,
Utils::OpenHandle(templ)->set_property_list(*list);
}
NeanderArray array(list);
- array.add(Utils::OpenHandle(*v8::Integer::New(length)));
+ array.add(isolate->factory()->NewNumberFromInt(length));
for (int i = 0; i < length; i++) {
i::Handle<i::Object> value = data[i].IsEmpty() ?
i::Handle<i::Object>(isolate->factory()->undefined_value()) :
@@ -902,10 +902,11 @@ void Template::Set(v8::Handle<String> name,
ENTER_V8(isolate);
i::HandleScope scope(isolate);
const int kSize = 3;
+ v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = {
name,
value,
- v8::Integer::New(attribute)};
+ v8::Integer::New(v8_isolate, attribute)};
TemplateSet(isolate, this, kSize, data);
}
@@ -922,12 +923,13 @@ void Template::SetAccessorProperty(
ASSERT(!getter.IsEmpty() || !setter.IsEmpty());
i::HandleScope scope(isolate);
const int kSize = 5;
+ v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = {
name,
getter,
setter,
- v8::Integer::New(attribute),
- v8::Integer::New(access_control)};
+ v8::Integer::New(v8_isolate, attribute),
+ v8::Integer::New(v8_isolate, access_control)};
TemplateSet(isolate, this, kSize, data);
}
@@ -1008,14 +1010,6 @@ Local<FunctionTemplate> FunctionTemplate::New(
}
-Local<FunctionTemplate> FunctionTemplate::New(
- FunctionCallback callback,
- v8::Handle<Value> data,
- v8::Handle<Signature> signature,
- int length) {
- return New(Isolate::GetCurrent(), callback, data, signature, length);
-}
-
Local<Signature> Signature::New(Isolate* isolate,
Handle<FunctionTemplate> receiver, int argc,
Handle<FunctionTemplate> argv[]) {
@@ -4124,10 +4118,11 @@ ScriptOrigin Function::GetScriptOrigin() const {
if (func->shared()->script()->IsScript()) {
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script);
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate());
v8::ScriptOrigin origin(
Utils::ToLocal(scriptName),
- v8::Integer::New(script->line_offset()->value()),
- v8::Integer::New(script->column_offset()->value()));
+ v8::Integer::New(isolate, script->line_offset()->value()),
+ v8::Integer::New(isolate, script->column_offset()->value()));
return origin;
}
return v8::ScriptOrigin(Handle<Value>());
@@ -5344,16 +5339,6 @@ void* External::Value() const {
}
-Local<String> v8::String::Empty() {
- i::Isolate* isolate = i::Isolate::Current();
- if (!EnsureInitializedForIsolate(isolate, "v8::String::Empty()")) {
- return v8::Local<String>();
- }
- LOG_API(isolate, "String::Empty()");
- return Utils::ToLocal(isolate->factory()->empty_string());
-}
-
-
// anonymous namespace for string creation helper functions
namespace {
@@ -5416,7 +5401,7 @@ inline Local<String> NewString(Isolate* v8_isolate,
EnsureInitializedForIsolate(isolate, location);
LOG_API(isolate, env);
if (length == 0 && type != String::kUndetectableString) {
- return String::Empty();
+ return String::Empty(v8_isolate);
}
ENTER_V8(isolate);
if (length == -1) length = StringLength(data);
@@ -5647,11 +5632,6 @@ Local<v8::Object> v8::Object::New(Isolate* isolate) {
}
-Local<v8::Object> v8::Object::New() {
- return New(Isolate::GetCurrent());
-}
-
-
Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()");
@@ -6137,13 +6117,6 @@ Local<Private> v8::Private::New(
}
-Local<Number> v8::Number::New(double value) {
- i::Isolate* isolate = i::Isolate::Current();
- EnsureInitializedForIsolate(isolate, "v8::Number::New()");
- return Number::New(reinterpret_cast<Isolate*>(isolate), value);
-}
-
-
Local<Number> v8::Number::New(Isolate* isolate, double value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized());
@@ -6157,30 +6130,6 @@ Local<Number> v8::Number::New(Isolate* isolate, double value) {
}
-Local<Integer> v8::Integer::New(int32_t value) {
- i::Isolate* isolate = i::Isolate::UncheckedCurrent();
- EnsureInitializedForIsolate(isolate, "v8::Integer::New()");
- return v8::Integer::New(reinterpret_cast<Isolate*>(isolate), value);
-}
-
-
-Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
- i::Isolate* isolate = i::Isolate::Current();
- EnsureInitializedForIsolate(isolate, "v8::Integer::NewFromUnsigned()");
- return Integer::NewFromUnsigned(reinterpret_cast<Isolate*>(isolate), value);
-}
-
-
-Local<Integer> v8::Integer::New(int32_t value, Isolate* isolate) {
- return Integer::New(isolate, value);
-}
-
-
-Local<Integer> v8::Integer::NewFromUnsigned(uint32_t value, Isolate* isolate) {
- return Integer::NewFromUnsigned(isolate, value);
-}
-
-
Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized());
@@ -6199,7 +6148,7 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
ASSERT(internal_isolate->IsInitialized());
bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) {
- return Integer::New(static_cast<int32_t>(value), isolate);
+ return Integer::New(isolate, static_cast<int32_t>(value));
}
ENTER_V8(internal_isolate);
i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
« no previous file with comments | « include/v8.h ('k') | src/d8-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698