Revision: 18008
Author: [email protected]
Date: Fri Nov 22 12:28:58 2013 UTC
Log: Remove usage of deprecated APIs from v8 itself
Also turn on depreaction warnings
BUG=v8:3023
[email protected], [email protected]
LOG=n
Review URL: https://codereview.chromium.org/83323003
http://code.google.com/p/v8/source/detail?r=18008
Modified:
/branches/bleeding_edge/src/allocation-tracker.cc
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/extensions/externalize-string-extension.cc
/branches/bleeding_edge/src/extensions/statistics-extension.cc
/branches/bleeding_edge/src/i18n.cc
/branches/bleeding_edge/src/mksnapshot.cc
/branches/bleeding_edge/tools/gyp/v8.gyp
=======================================
--- /branches/bleeding_edge/src/allocation-tracker.cc Thu Nov 14 12:13:26
2013 UTC
+++ /branches/bleeding_edge/src/allocation-tracker.cc Fri Nov 22 12:28:58
2013 UTC
@@ -272,7 +272,7 @@
void* data) {
UnresolvedLocation* location =
reinterpret_cast<UnresolvedLocation*>(data);
location->script_ = Handle<Script>::null();
- obj->Dispose();
+ obj->Reset();
}
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Nov 21 14:07:06 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Fri Nov 22 12:28:58 2013 UTC
@@ -3401,13 +3401,14 @@
Local<String> v8::Object::ObjectProtoToString() {
- i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
+ i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
+ Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
+ ON_BAILOUT(i_isolate, "v8::Object::ObjectProtoToString()",
return Local<v8::String>());
- ENTER_V8(isolate);
+ ENTER_V8(i_isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- i::Handle<i::Object> name(self->class_name(), isolate);
+ i::Handle<i::Object> name(self->class_name(), i_isolate);
// Native implementation of Object.prototype.toString (v8natives.js):
// var c = %_ClassOf(this);
@@ -3415,13 +3416,11 @@
// return "[object " + c + "]";
if (!name->IsString()) {
- return v8::String::New("[object ]");
-
+ return v8::String::NewFromUtf8(isolate, "[object ]");
} else {
i::Handle<i::String> class_name = i::Handle<i::String>::cast(name);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) {
- return v8::String::New("[object Object]");
-
+ return v8::String::NewFromUtf8(isolate, "[object Object]");
} else {
const char* prefix = "[object ";
Local<String> str = Utils::ToLocal(class_name);
@@ -3447,7 +3446,8 @@
i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
// Copy the buffer into a heap-allocated string and return it.
- Local<String> result = v8::String::New(buf.start(), buf_len);
+ Local<String> result = v8::String::NewFromUtf8(
+ isolate, buf.start(), String::kNormalString, buf_len);
return result;
}
}
=======================================
--- /branches/bleeding_edge/src/debug.cc Tue Nov 19 13:19:51 2013 UTC
+++ /branches/bleeding_edge/src/debug.cc Fri Nov 22 12:28:58 2013 UTC
@@ -709,7 +709,7 @@
script_cache->collected_scripts_.Add(id);
// Clear the weak handle.
- obj->Dispose();
+ obj->Reset();
}
@@ -3071,6 +3071,7 @@
Handle<JSObject> exec_state,
Handle<JSObject> event_data,
bool auto_continue) {
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_);
HandleScope scope(isolate_);
if (!isolate_->debug()->Load()) return;
@@ -3131,8 +3132,8 @@
{
v8::Local<v8::Object> api_exec_state =
v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
- v8::Local<v8::String> fun_name =
- v8::String::New("debugCommandProcessor");
+ v8::Local<v8::String> fun_name = v8::String::NewFromUtf8(
+ isolate, "debugCommandProcessor");
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
@@ -3179,11 +3180,12 @@
v8::Local<v8::Function> fun;
v8::Local<v8::Value> request;
v8::TryCatch try_catch;
- fun_name = v8::String::New("processDebugRequest");
+ fun_name = v8::String::NewFromUtf8(isolate, "processDebugRequest");
fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
- request = v8::String::New(command.text().start(),
- command.text().length());
+ request = v8::String::NewFromTwoByte(isolate, command.text().start(),
+ v8::String::kNormalString,
+ command.text().length());
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { request };
v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc,
argv);
@@ -3195,7 +3197,7 @@
if (!response_val->IsUndefined()) {
response = v8::Local<v8::String>::Cast(response_val);
} else {
- response = v8::String::New("");
+ response = v8::String::NewFromUtf8(isolate, "");
}
// Log the JSON request/response.
@@ -3205,7 +3207,7 @@
}
// Get the running state.
- fun_name = v8::String::New("isRunning");
+ fun_name = v8::String::NewFromUtf8(isolate, "isRunning");
fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { response };
=======================================
--- /branches/bleeding_edge/src/extensions/externalize-string-extension.cc
Thu Sep 26 07:37:59 2013 UTC
+++ /branches/bleeding_edge/src/extensions/externalize-string-extension.cc
Fri Nov 22 12:28:58 2013 UTC
@@ -75,7 +75,8 @@
void ExternalizeStringExtension::Externalize(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() < 1 || !args[0]->IsString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"First parameter to externalizeString() must be a string."));
return;
}
@@ -84,7 +85,8 @@
if (args[1]->IsBoolean()) {
force_two_byte = args[1]->BooleanValue();
} else {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"Second parameter to externalizeString() must be a boolean."));
return;
}
@@ -92,7 +94,8 @@
bool result = false;
Handle<String> string = Utils::OpenHandle(*args[0].As<v8::String>());
if (string->IsExternalString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"externalizeString() can't externalize twice."));
return;
}
@@ -120,8 +123,8 @@
if (!result) delete resource;
}
if (!result) {
- args.GetIsolate()->ThrowException(
- v8::String::New("externalizeString() failed."));
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(), "externalizeString() failed."));
return;
}
}
@@ -130,7 +133,8 @@
void ExternalizeStringExtension::IsAscii(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"isAsciiString() requires a single string argument."));
return;
}
=======================================
--- /branches/bleeding_edge/src/extensions/statistics-extension.cc Thu Nov
21 08:38:51 2013 UTC
+++ /branches/bleeding_edge/src/extensions/statistics-extension.cc Fri Nov
22 12:28:58 2013 UTC
@@ -41,27 +41,30 @@
}
-static void AddCounter(v8::Local<v8::Object> object,
+static void AddCounter(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
StatsCounter* counter,
const char* name) {
if (counter->Enabled()) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(*counter->GetInternalPointer()));
}
}
-static void AddNumber(v8::Local<v8::Object> object,
+static void AddNumber(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
intptr_t value,
const char* name) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value)));
}
-static void AddNumber64(v8::Local<v8::Object> object,
+static void AddNumber64(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
int64_t value,
const char* name) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value)));
}
@@ -81,79 +84,87 @@
v8::Local<v8::Object> result = v8::Object::New();
#define ADD_COUNTER(name,
caption) \
- AddCounter(result, counters->name(), #name);
+ AddCounter(args.GetIsolate(), result, counters->name(), #name);
STATS_COUNTER_LIST_1(ADD_COUNTER)
STATS_COUNTER_LIST_2(ADD_COUNTER)
#undef ADD_COUNTER
-#define
ADD_COUNTER(name) \
- AddCounter(result, counters->count_of_##name(), "count_of_"
#name); \
- AddCounter(result, counters->size_of_##name(), "size_of_" #name);
+#define
ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(), result,
counters->count_of_##name(), \
+ "count_of_"
#name); \
+ AddCounter(args.GetIsolate(), result,
counters->size_of_##name(), \
+ "size_of_" #name);
INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
-#define
ADD_COUNTER(name) \
- AddCounter(result,
counters->count_of_CODE_TYPE_##name(), \
- "count_of_CODE_TYPE_"
#name); \
- AddCounter(result,
counters->size_of_CODE_TYPE_##name(), \
+#define
ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(), result,
counters->count_of_CODE_TYPE_##name(), \
+ "count_of_CODE_TYPE_"
#name); \
+ AddCounter(args.GetIsolate(), result,
counters->size_of_CODE_TYPE_##name(), \
"size_of_CODE_TYPE_" #name);
CODE_KIND_LIST(ADD_COUNTER)
#undef ADD_COUNTER
-#define
ADD_COUNTER(name) \
- AddCounter(result,
counters->count_of_FIXED_ARRAY_##name(), \
- "count_of_FIXED_ARRAY_"
#name); \
- AddCounter(result,
counters->size_of_FIXED_ARRAY_##name(), \
+#define
ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(),
result, \
+
counters->count_of_FIXED_ARRAY_##name(), \
+ "count_of_FIXED_ARRAY_"
#name); \
+ AddCounter(args.GetIsolate(),
result, \
+
counters->size_of_FIXED_ARRAY_##name(), \
"size_of_FIXED_ARRAY_" #name);
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
- AddNumber(result, isolate->memory_allocator()->Size(),
+ AddNumber(args.GetIsolate(), result, isolate->memory_allocator()->Size(),
"total_committed_bytes");
- AddNumber(result, heap->new_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->new_space()->Size(),
"new_space_live_bytes");
- AddNumber(result, heap->new_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->new_space()->Available(),
"new_space_available_bytes");
- AddNumber(result, heap->new_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
heap->new_space()->CommittedMemory(),
"new_space_commited_bytes");
- AddNumber(result, heap->old_pointer_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->old_pointer_space()->Size(),
"old_pointer_space_live_bytes");
- AddNumber(result, heap->old_pointer_space()->Available(),
+ AddNumber(args.GetIsolate(), result,
heap->old_pointer_space()->Available(),
"old_pointer_space_available_bytes");
- AddNumber(result, heap->old_pointer_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->old_pointer_space()->CommittedMemory(),
"old_pointer_space_commited_bytes");
- AddNumber(result, heap->old_data_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->old_data_space()->Size(),
"old_data_space_live_bytes");
- AddNumber(result, heap->old_data_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->old_data_space()->Available(),
"old_data_space_available_bytes");
- AddNumber(result, heap->old_data_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->old_data_space()->CommittedMemory(),
"old_data_space_commited_bytes");
- AddNumber(result, heap->code_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->code_space()->Size(),
"code_space_live_bytes");
- AddNumber(result, heap->code_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->code_space()->Available(),
"code_space_available_bytes");
- AddNumber(result, heap->code_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
heap->code_space()->CommittedMemory(),
"code_space_commited_bytes");
- AddNumber(result, heap->cell_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->cell_space()->Size(),
"cell_space_live_bytes");
- AddNumber(result, heap->cell_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->cell_space()->Available(),
"cell_space_available_bytes");
- AddNumber(result, heap->cell_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
heap->cell_space()->CommittedMemory(),
"cell_space_commited_bytes");
- AddNumber(result, heap->property_cell_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->property_cell_space()->Size(),
"property_cell_space_live_bytes");
- AddNumber(result, heap->property_cell_space()->Available(),
+ AddNumber(args.GetIsolate(), result,
heap->property_cell_space()->Available(),
"property_cell_space_available_bytes");
- AddNumber(result, heap->property_cell_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->property_cell_space()->CommittedMemory(),
"property_cell_space_commited_bytes");
- AddNumber(result, heap->lo_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->Size(),
"lo_space_live_bytes");
- AddNumber(result, heap->lo_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->Available(),
"lo_space_available_bytes");
- AddNumber(result, heap->lo_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->CommittedMemory(),
"lo_space_commited_bytes");
- AddNumber64(result, heap->amount_of_external_allocated_memory(),
+ AddNumber64(args.GetIsolate(), result,
+ heap->amount_of_external_allocated_memory(),
"amount_of_external_allocated_memory");
args.GetReturnValue().Set(result);
}
=======================================
--- /branches/bleeding_edge/src/i18n.cc Tue Sep 17 11:54:32 2013 UTC
+++ /branches/bleeding_edge/src/i18n.cc Fri Nov 22 12:28:58 2013 UTC
@@ -872,7 +872,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -936,7 +936,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -997,7 +997,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -1064,7 +1064,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(1));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
} } // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc Tue Nov 12 07:03:59 2013 UTC
+++ /branches/bleeding_edge/src/mksnapshot.cc Fri Nov 22 12:28:58 2013 UTC
@@ -332,7 +332,7 @@
i += read;
}
fclose(file);
- Local<String> source = String::New(chars);
+ Local<String> source = String::NewFromUtf8(isolate, chars);
TryCatch try_catch;
Local<Script> script = Script::Compile(source);
if (try_catch.HasCaught()) {
@@ -358,7 +358,7 @@
internal_isolate->heap()->CollectAllGarbage(
i::Heap::kNoGCFlags, "mksnapshot");
i::Object* raw_context = *v8::Utils::OpenPersistent(context);
- context.Dispose();
+ context.Reset();
CppByteSink sink(argv[1]);
// This results in a somewhat smaller snapshot, probably because it gets
rid
// of some things that are cached between garbage collections.
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp Fri Nov 22 10:57:55 2013 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp Fri Nov 22 12:28:58 2013 UTC
@@ -30,12 +30,6 @@
'v8_code': 1,
'v8_random_seed%': 314159265,
},
- 'target_defaults': {
- 'variables': {
- # TODO(jochen): enable warnings.
- 'v8_deprecation_warnings': 0,
- },
- },
'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
'targets': [
{
--
--
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.