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

Unified Diff: src/runtime.cc

Issue 200363002: Handlify callers of Object::GetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index b9dc4181c50b0a10d79bf7af43275089dbf0c47b..0ee2017a4e14fc08a9ea0350737a6a6fca1d971f 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4800,11 +4800,15 @@ MaybeObject* Runtime::GetElementOrCharAt(Isolate* isolate,
if (!result->IsUndefined()) return *result;
}
+ Handle<Object> result;
if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
- return object->GetPrototype(isolate)->GetElement(isolate, index);
+ Handle<Object> proto(object->GetPrototype(isolate), isolate);
+ result = Object::GetElement(isolate, proto, index);
+ } else {
+ result = Object::GetElement(isolate, object, index);
}
-
- return object->GetElement(isolate, index);
+ RETURN_IF_EMPTY_HANDLE(isolate, result);
+ return *result;
}
@@ -5982,7 +5986,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) {
if (index < n) {
return frame->GetParameter(index);
} else {
- return isolate->initial_object_prototype()->GetElement(isolate, index);
+ Handle<Object> initial_prototype(isolate->initial_object_prototype());
+ Handle<Object> result =
+ Object::GetElement(isolate, initial_prototype, index);
+ RETURN_IF_EMPTY_HANDLE(isolate, result);
+ return *result;
}
}
@@ -8826,6 +8834,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) {
for (int i = 0; i < argc; ++i) {
argv[i] = Object::GetElement(isolate, arguments, offset + i);
+ RETURN_IF_EMPTY_HANDLE(isolate, argv[i]);
}
bool threw;
@@ -13689,14 +13698,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetLanguageTagVariants) {
Handle<Name> base =
isolate->factory()->NewStringFromAscii(CStrVector("base"));
for (unsigned int i = 0; i < length; ++i) {
- MaybeObject* maybe_string = input->GetElement(isolate, i);
- Object* locale_id;
- if (!maybe_string->ToObject(&locale_id) || !locale_id->IsString()) {
+ Handle<Object> locale_id = Object::GetElement(isolate, input, i);
+ RETURN_IF_EMPTY_HANDLE(isolate, locale_id);
+ if (!locale_id->IsString()) {
return isolate->Throw(isolate->heap()->illegal_argument_string());
}
v8::String::Utf8Value utf8_locale_id(
- v8::Utils::ToLocal(Handle<String>(String::cast(locale_id))));
+ v8::Utils::ToLocal(Handle<String>::cast(locale_id)));
UErrorCode error = U_ZERO_ERROR;
@@ -14553,15 +14562,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Log) {
- SealHandleScope shs(isolate);
+ HandleScope handle_scope(isolate);
ASSERT(args.length() == 2);
- CONVERT_ARG_CHECKED(String, format, 0);
- CONVERT_ARG_CHECKED(JSArray, elms, 1);
- DisallowHeapAllocation no_gc;
- String::FlatContent format_content = format->GetFlatContent();
- RUNTIME_ASSERT(format_content.IsAscii());
- Vector<const uint8_t> chars = format_content.ToOneByteVector();
- isolate->logger()->LogRuntime(Vector<const char>::cast(chars), elms);
+ CONVERT_ARG_HANDLE_CHECKED(String, format, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSArray, elms, 1);
+
+ SmartArrayPointer<char> format_chars = format->ToCString();
+ isolate->logger()->LogRuntime(
+ Vector<const char>(format_chars.get(), format->length()), elms);
return isolate->heap()->undefined_value();
}
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698