From 6466ff39fb244390554a8354c5864fe90cd37655 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Mon, 14 Jul 2014 14:52:24 +0000 Subject: [PATCH] Remove PropertyAttributes from SetProperty BUG= R=ishell@chromium.org Review URL: https://codereview.chromium.org/390833003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8.h | 4 +- src/api.cc | 21 ++++------- src/debug.cc | 6 +-- src/factory.cc | 6 +-- src/i18n.cc | 40 -------------------- src/ic.cc | 18 +++------ src/isolate.cc | 7 ++-- src/liveedit.cc | 12 +++--- src/objects-inl.h | 3 +- src/objects.cc | 59 +++++++++++------------------- src/objects.h | 8 ---- src/runtime.cc | 35 ++++++++---------- src/runtime.h | 10 +---- src/stub-cache.cc | 6 +-- test/cctest/test-api.cc | 27 ++++++++------ test/cctest/test-heap.cc | 45 ++++++++++------------- test/cctest/test-mark-compact.cc | 6 +-- test/cctest/test-object-observe.cc | 4 +- 18 files changed, 109 insertions(+), 208 deletions(-) diff --git a/include/v8.h b/include/v8.h index 82d5784514..ee3acabc41 100644 --- a/include/v8.h +++ b/include/v8.h @@ -2096,9 +2096,7 @@ enum AccessControl { */ class V8_EXPORT Object : public Value { public: - bool Set(Handle key, - Handle value, - PropertyAttribute attribs = None); + bool Set(Handle key, Handle value); bool Set(uint32_t index, Handle value); diff --git a/src/api.cc b/src/api.cc index 2c50d753f1..031b4f4660 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3023,11 +3023,7 @@ uint32_t Value::Uint32Value() const { } -// TODO(verwaest): Remove the attribs argument, since it doesn't make sense for -// existing properties. Use ForceSet instead to define or redefine properties -// with specific attributes. -bool v8::Object::Set(v8::Handle key, v8::Handle value, - v8::PropertyAttribute attribs) { +bool v8::Object::Set(v8::Handle key, v8::Handle value) { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); ON_BAILOUT(isolate, "v8::Object::Set()", return false); ENTER_V8(isolate); @@ -3036,9 +3032,9 @@ bool v8::Object::Set(v8::Handle key, v8::Handle value, i::Handle key_obj = Utils::OpenHandle(*key); i::Handle value_obj = Utils::OpenHandle(*value); EXCEPTION_PREAMBLE(isolate); - has_pending_exception = i::Runtime::SetObjectProperty( - isolate, self, key_obj, value_obj, i::SLOPPY, - static_cast(attribs)).is_null(); + has_pending_exception = + i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj, + i::SLOPPY).is_null(); EXCEPTION_BAILOUT_CHECK(isolate, false); return true; } @@ -6173,8 +6169,7 @@ Local v8::Symbol::For(Isolate* isolate, Local name) { ASSERT(symbol->IsUndefined()); symbol = i_isolate->factory()->NewSymbol(); i::Handle::cast(symbol)->set_name(*i_name); - i::JSObject::SetProperty( - symbols, i_name, symbol, NONE, i::STRICT).Assert(); + i::JSObject::SetProperty(symbols, i_name, symbol, i::STRICT).Assert(); } return Utils::ToLocal(i::Handle::cast(symbol)); } @@ -6194,8 +6189,7 @@ Local v8::Symbol::ForApi(Isolate* isolate, Local name) { ASSERT(symbol->IsUndefined()); symbol = i_isolate->factory()->NewSymbol(); i::Handle::cast(symbol)->set_name(*i_name); - i::JSObject::SetProperty( - symbols, i_name, symbol, NONE, i::STRICT).Assert(); + i::JSObject::SetProperty(symbols, i_name, symbol, i::STRICT).Assert(); } return Utils::ToLocal(i::Handle::cast(symbol)); } @@ -6227,8 +6221,7 @@ Local v8::Private::ForApi(Isolate* isolate, Local name) { ASSERT(symbol->IsUndefined()); symbol = i_isolate->factory()->NewPrivateSymbol(); i::Handle::cast(symbol)->set_name(*i_name); - i::JSObject::SetProperty( - privates, i_name, symbol, NONE, i::STRICT).Assert(); + i::JSObject::SetProperty(privates, i_name, symbol, i::STRICT).Assert(); } Local result = Utils::ToLocal(i::Handle::cast(symbol)); return v8::Handle(reinterpret_cast(*result)); diff --git a/src/debug.cc b/src/debug.cc index 9d1f2affe5..a831e84bff 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -826,9 +826,7 @@ bool Debug::Load() { Handle builtin = Handle(global->builtins(), isolate_); RETURN_ON_EXCEPTION_VALUE( - isolate_, - JSReceiver::SetProperty(global, key, builtin, NONE, SLOPPY), - false); + isolate_, JSReceiver::SetProperty(global, key, builtin, SLOPPY), false); // Compile the JavaScript for the debugger in the debugger context. bool caught_exception = @@ -2454,12 +2452,10 @@ void Debug::ClearMirrorCache() { JSObject::SetProperty(global, factory->NewStringFromAsciiChecked("next_handle_"), handle(Smi::FromInt(0), isolate_), - NONE, SLOPPY).Check(); JSObject::SetProperty(global, factory->NewStringFromAsciiChecked("mirror_cache_"), factory->NewJSArray(0, FAST_ELEMENTS), - NONE, SLOPPY).Check(); } diff --git a/src/factory.cc b/src/factory.cc index 8c08ba1587..36511d6ade 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -2098,11 +2098,9 @@ Handle Factory::NewArgumentsObject(Handle callee, ASSERT(!isolate()->has_pending_exception()); Handle result = NewJSObjectFromMap(map); Handle value(Smi::FromInt(length), isolate()); - JSReceiver::SetProperty(result, length_string(), value, NONE, STRICT) - .Assert(); + JSReceiver::SetProperty(result, length_string(), value, STRICT).Assert(); if (!strict_mode_callee) { - JSReceiver::SetProperty(result, callee_string(), callee, NONE, STRICT) - .Assert(); + JSReceiver::SetProperty(result, callee_string(), callee, STRICT).Assert(); } return result; } diff --git a/src/i18n.cc b/src/i18n.cc index 900da188c4..c1e69739bd 100644 --- a/src/i18n.cc +++ b/src/i18n.cc @@ -137,7 +137,6 @@ void SetResolvedDateSettings(Isolate* isolate, Vector( reinterpret_cast(pattern.getBuffer()), pattern.length())).ToHandleChecked(), - NONE, SLOPPY).Assert(); // Set time zone and calendar. @@ -147,7 +146,6 @@ void SetResolvedDateSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("calendar"), factory->NewStringFromAsciiChecked(calendar_name), - NONE, SLOPPY).Assert(); const icu::TimeZone& tz = calendar->getTimeZone(); @@ -162,7 +160,6 @@ void SetResolvedDateSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("timeZone"), factory->NewStringFromStaticAscii("UTC"), - NONE, SLOPPY).Assert(); } else { JSObject::SetProperty( @@ -173,7 +170,6 @@ void SetResolvedDateSettings(Isolate* isolate, reinterpret_cast( canonical_time_zone.getBuffer()), canonical_time_zone.length())).ToHandleChecked(), - NONE, SLOPPY).Assert(); } } @@ -190,14 +186,12 @@ void SetResolvedDateSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("numberingSystem"), factory->NewStringFromAsciiChecked(ns), - NONE, SLOPPY).Assert(); } else { JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("numberingSystem"), factory->undefined_value(), - NONE, SLOPPY).Assert(); } delete numbering_system; @@ -212,7 +206,6 @@ void SetResolvedDateSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromAsciiChecked(result), - NONE, SLOPPY).Assert(); } else { // This would never happen, since we got the locale from ICU. @@ -220,7 +213,6 @@ void SetResolvedDateSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromStaticAscii("und"), - NONE, SLOPPY).Assert(); } } @@ -364,7 +356,6 @@ void SetResolvedNumberSettings(Isolate* isolate, Vector( reinterpret_cast(pattern.getBuffer()), pattern.length())).ToHandleChecked(), - NONE, SLOPPY).Assert(); // Set resolved currency code in options.currency if not empty. @@ -377,7 +368,6 @@ void SetResolvedNumberSettings(Isolate* isolate, Vector( reinterpret_cast(currency.getBuffer()), currency.length())).ToHandleChecked(), - NONE, SLOPPY).Assert(); } @@ -393,14 +383,12 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("numberingSystem"), factory->NewStringFromAsciiChecked(ns), - NONE, SLOPPY).Assert(); } else { JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("numberingSystem"), factory->undefined_value(), - NONE, SLOPPY).Assert(); } delete numbering_system; @@ -409,28 +397,24 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("useGrouping"), factory->ToBoolean(number_format->isGroupingUsed()), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("minimumIntegerDigits"), factory->NewNumberFromInt(number_format->getMinimumIntegerDigits()), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("minimumFractionDigits"), factory->NewNumberFromInt(number_format->getMinimumFractionDigits()), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("maximumFractionDigits"), factory->NewNumberFromInt(number_format->getMaximumFractionDigits()), - NONE, SLOPPY).Assert(); Handle key = @@ -440,7 +424,6 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("minimumSignificantDigits"), factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()), - NONE, SLOPPY).Assert(); } @@ -450,7 +433,6 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("maximumSignificantDigits"), factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()), - NONE, SLOPPY).Assert(); } @@ -464,7 +446,6 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromAsciiChecked(result), - NONE, SLOPPY).Assert(); } else { // This would never happen, since we got the locale from ICU. @@ -472,7 +453,6 @@ void SetResolvedNumberSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromStaticAscii("und"), - NONE, SLOPPY).Assert(); } } @@ -554,7 +534,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, factory->NewStringFromStaticAscii("numeric"), factory->ToBoolean( collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON), - NONE, SLOPPY).Assert(); switch (collator->getAttribute(UCOL_CASE_FIRST, status)) { @@ -563,7 +542,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("caseFirst"), factory->NewStringFromStaticAscii("lower"), - NONE, SLOPPY).Assert(); break; case UCOL_UPPER_FIRST: @@ -571,7 +549,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("caseFirst"), factory->NewStringFromStaticAscii("upper"), - NONE, SLOPPY).Assert(); break; default: @@ -579,7 +556,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("caseFirst"), factory->NewStringFromStaticAscii("false"), - NONE, SLOPPY).Assert(); } @@ -589,7 +565,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("strength"), factory->NewStringFromStaticAscii("primary"), - NONE, SLOPPY).Assert(); // case level: true + s1 -> case, s1 -> base. @@ -598,14 +573,12 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("case"), - NONE, SLOPPY).Assert(); } else { JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("base"), - NONE, SLOPPY).Assert(); } break; @@ -615,13 +588,11 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("strength"), factory->NewStringFromStaticAscii("secondary"), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("accent"), - NONE, SLOPPY).Assert(); break; case UCOL_TERTIARY: @@ -629,13 +600,11 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("strength"), factory->NewStringFromStaticAscii("tertiary"), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("variant"), - NONE, SLOPPY).Assert(); break; case UCOL_QUATERNARY: @@ -645,13 +614,11 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("strength"), factory->NewStringFromStaticAscii("quaternary"), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("variant"), - NONE, SLOPPY).Assert(); break; default: @@ -659,13 +626,11 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("strength"), factory->NewStringFromStaticAscii("identical"), - NONE, SLOPPY).Assert(); JSObject::SetProperty( resolved, factory->NewStringFromStaticAscii("sensitivity"), factory->NewStringFromStaticAscii("variant"), - NONE, SLOPPY).Assert(); } @@ -674,7 +639,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, factory->NewStringFromStaticAscii("ignorePunctuation"), factory->ToBoolean(collator->getAttribute( UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED), - NONE, SLOPPY).Assert(); // Set the locale @@ -687,7 +651,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromAsciiChecked(result), - NONE, SLOPPY).Assert(); } else { // This would never happen, since we got the locale from ICU. @@ -695,7 +658,6 @@ void SetResolvedCollatorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromStaticAscii("und"), - NONE, SLOPPY).Assert(); } } @@ -751,7 +713,6 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromAsciiChecked(result), - NONE, SLOPPY).Assert(); } else { // This would never happen, since we got the locale from ICU. @@ -759,7 +720,6 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate, resolved, factory->NewStringFromStaticAscii("locale"), factory->NewStringFromStaticAscii("und"), - NONE, SLOPPY).Assert(); } } diff --git a/src/ic.cc b/src/ic.cc index e2123d0f7c..2b9e29c3c1 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -1287,10 +1287,8 @@ MaybeHandle StoreIC::Store(Handle object, Handle receiver = Handle::cast(object); Handle result; ASSIGN_RETURN_ON_EXCEPTION( - isolate(), - result, - JSReceiver::SetProperty(receiver, name, value, NONE, strict_mode()), - Object); + isolate(), result, + JSReceiver::SetProperty(receiver, name, value, strict_mode()), Object); return result; } @@ -1328,10 +1326,8 @@ MaybeHandle StoreIC::Store(Handle object, if (receiver->map()->is_observed()) { Handle result; ASSIGN_RETURN_ON_EXCEPTION( - isolate(), - result, - JSReceiver::SetProperty( - receiver, name, value, NONE, strict_mode(), store_mode), + isolate(), result, JSReceiver::SetProperty(receiver, name, value, + strict_mode(), store_mode), Object); return result; } @@ -1362,10 +1358,8 @@ MaybeHandle StoreIC::Store(Handle object, // Set the property. Handle result; ASSIGN_RETURN_ON_EXCEPTION( - isolate(), - result, - JSReceiver::SetProperty( - receiver, name, value, NONE, strict_mode(), store_mode), + isolate(), result, + JSReceiver::SetProperty(receiver, name, value, strict_mode(), store_mode), Object); return result; } diff --git a/src/isolate.cc b/src/isolate.cc index 5e7fc71cd8..d48ae8b2b3 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -424,8 +424,7 @@ void Isolate::CaptureAndSetDetailedStackTrace(Handle error_object) { Handle stack_trace = CaptureCurrentStackTrace( stack_trace_for_uncaught_exceptions_frame_limit_, stack_trace_for_uncaught_exceptions_options_); - JSObject::SetProperty( - error_object, key, stack_trace, NONE, STRICT).Assert(); + JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); } } @@ -435,7 +434,7 @@ void Isolate::CaptureAndSetSimpleStackTrace(Handle error_object, // Capture stack trace for simple stack trace string formatting. Handle key = factory()->stack_trace_symbol(); Handle stack_trace = CaptureSimpleStackTrace(error_object, caller); - JSObject::SetProperty(error_object, key, stack_trace, NONE, STRICT).Assert(); + JSObject::SetProperty(error_object, key, stack_trace, STRICT).Assert(); } @@ -2207,7 +2206,7 @@ Handle Isolate::GetSymbolRegistry() { Handle name = factory()->InternalizeUtf8String(nested[i]); Handle obj = factory()->NewJSObjectFromMap(map); JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); - JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); + JSObject::SetProperty(registry, name, obj, STRICT).Assert(); } } return Handle::cast(factory()->symbol_registry()); diff --git a/src/liveedit.cc b/src/liveedit.cc index a52eef7e18..adf1f7162a 100644 --- a/src/liveedit.cc +++ b/src/liveedit.cc @@ -885,12 +885,12 @@ MaybeHandle LiveEdit::GatherCompileInfo(Handle