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

Unified Diff: src/runtime.cc

Issue 352813002: Wrap InitializeProperty around SetOwnPropertyIgnoreAttributes and switch over uses (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
« src/objects.h ('K') | « src/objects.cc ('k') | no next file » | 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 7a2049e3cd0198cc4ff43d58330908586afc9185..7a63c5a9358fb41a07b5cf7d631070776852afee 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -295,8 +295,7 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
const char* str = DoubleToCString(num, buffer);
Handle<String> name = isolate->factory()->NewStringFromAsciiChecked(str);
maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
- boilerplate, name, value, NONE,
- value_type, mode);
+ boilerplate, name, value, NONE, value_type, mode);
}
// If setting the property on the boilerplate throws an
// exception, the exception is converted to an empty handle in
@@ -2417,10 +2416,7 @@ RUNTIME_FUNCTION(RuntimeHidden_InitializeConstGlobal) {
if (!lookup.IsFound()) {
HandleScope handle_scope(isolate);
Handle<GlobalObject> global(isolate->context()->global_object());
- RETURN_FAILURE_ON_EXCEPTION(
- isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(global, name, value,
- attributes));
+ JSObject::InitializeProperty(global, name, value, attributes);
return *value;
}
@@ -8133,8 +8129,8 @@ RUNTIME_FUNCTION(Runtime_FunctionBindArguments) {
static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY);
RETURN_FAILURE_ON_EXCEPTION(
isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(bound_function, length_string,
- new_length, attr));
+ JSObject::SetOwnPropertyIgnoreAttributes(
rossberg 2014/06/27 10:51:02 Why can't InitProperty be used here?
Toon Verwaest 2014/06/30 11:39:38 Because "length" is already declared on the bound_
+ bound_function, length_string, new_length, attr));
return *bound_function;
}
@@ -13797,18 +13793,10 @@ RUNTIME_FUNCTION(Runtime_GetLanguageTagVariants) {
}
Handle<JSObject> result = factory->NewJSObject(isolate->object_function());
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- result,
- maximized,
- factory->NewStringFromAsciiChecked(base_max_locale),
- NONE));
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- result,
- base,
- factory->NewStringFromAsciiChecked(base_locale),
- NONE));
+ Handle<String> value = factory->NewStringFromAsciiChecked(base_max_locale);
+ JSObject::InitializeProperty(result, maximized, value, NONE);
+ value = factory->NewStringFromAsciiChecked(base_locale);
+ JSObject::InitializeProperty(result, base, value, NONE);
output->set(i, *result);
}
@@ -13925,12 +13913,10 @@ RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(date_format));
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- local_object,
- isolate->factory()->NewStringFromStaticAscii("dateFormat"),
- isolate->factory()->NewStringFromStaticAscii("valid"),
- NONE));
+ Factory* factory = isolate->factory();
+ Handle<String> key = factory->NewStringFromStaticAscii("dateFormat");
+ Handle<String> value = factory->NewStringFromStaticAscii("valid");
+ JSObject::InitializeProperty(local_object, key, value, NONE);
// Make object handle weak so we can delete the data format once GC kicks in.
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
@@ -14024,12 +14010,10 @@ RUNTIME_FUNCTION(Runtime_CreateNumberFormat) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(number_format));
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- local_object,
- isolate->factory()->NewStringFromStaticAscii("numberFormat"),
- isolate->factory()->NewStringFromStaticAscii("valid"),
- NONE));
+ Factory* factory = isolate->factory();
+ Handle<String> key = factory->NewStringFromStaticAscii("numberFormat");
+ Handle<String> value = factory->NewStringFromStaticAscii("valid");
+ JSObject::InitializeProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
@@ -14132,12 +14116,10 @@ RUNTIME_FUNCTION(Runtime_CreateCollator) {
local_object->SetInternalField(0, reinterpret_cast<Smi*>(collator));
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- local_object,
- isolate->factory()->NewStringFromStaticAscii("collator"),
- isolate->factory()->NewStringFromStaticAscii("valid"),
- NONE));
+ Factory* factory = isolate->factory();
+ Handle<String> key = factory->NewStringFromStaticAscii("collator");
+ Handle<String> value = factory->NewStringFromStaticAscii("valid");
+ JSObject::InitializeProperty(local_object, key, value, NONE);
Handle<Object> wrapper = isolate->global_handles()->Create(*local_object);
GlobalHandles::MakeWeak(wrapper.location(),
@@ -14238,12 +14220,10 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
// Make sure that the pointer to adopted text is NULL.
local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL));
- RETURN_FAILURE_ON_EXCEPTION(isolate,
- JSObject::SetOwnPropertyIgnoreAttributes(
- local_object,
- isolate->factory()->NewStringFromStaticAscii("breakIterator"),
- isolate->factory()->NewStringFromStaticAscii("valid"),
- NONE));
+ Factory* factory = isolate->factory();
+ Handle<String> key = factory->NewStringFromStaticAscii("breakIterator");
+ Handle<String> value = factory->NewStringFromStaticAscii("valid");
+ JSObject::InitializeProperty(local_object, key, value, NONE);
// Make object handle weak so we can delete the break iterator once GC kicks
// in.
« src/objects.h ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698