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

Unified Diff: src/v8natives.js

Issue 351853005: Split SetProperty(...attributes, strictmode) into AddProperty(...attributes) and SetProperty(...… (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
« no previous file with comments | « src/typedarray.js ('k') | src/weak_collection.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 1d05338016b908586ed59e1e91129bce0a2a4f4c..4f12eecfc8faf46ce36c3d881acf504be6b7726f 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -28,7 +28,7 @@ function InstallFunctions(object, attributes, functions) {
var f = functions[i + 1];
%FunctionSetName(f, key);
%FunctionRemovePrototype(f);
- %SetProperty(object, key, f, attributes);
+ %AddProperty(object, key, f, attributes);
%SetNativeFlag(f);
}
%ToFastProperties(object);
@@ -39,7 +39,7 @@ function InstallFunctions(object, attributes, functions) {
function InstallGetter(object, name, getter) {
%FunctionSetName(getter, name);
%FunctionRemovePrototype(getter);
- %DefineOrRedefineAccessorProperty(object, name, getter, null, DONT_ENUM);
+ %DefineAccessorPropertyUnchecked(object, name, getter, null, DONT_ENUM);
%SetNativeFlag(getter);
}
@@ -50,7 +50,7 @@ function InstallGetterSetter(object, name, getter, setter) {
%FunctionSetName(setter, name);
%FunctionRemovePrototype(getter);
%FunctionRemovePrototype(setter);
- %DefineOrRedefineAccessorProperty(object, name, getter, setter, DONT_ENUM);
+ %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM);
%SetNativeFlag(getter);
%SetNativeFlag(setter);
}
@@ -65,7 +65,7 @@ function InstallConstants(object, constants) {
for (var i = 0; i < constants.length; i += 2) {
var name = constants[i];
var k = constants[i + 1];
- %SetProperty(object, name, k, attributes);
+ %AddProperty(object, name, k, attributes);
}
%ToFastProperties(object);
}
@@ -86,13 +86,13 @@ function SetUpLockedPrototype(constructor, fields, methods) {
}
if (fields) {
for (var i = 0; i < fields.length; i++) {
- %SetProperty(prototype, fields[i], UNDEFINED, DONT_ENUM | DONT_DELETE);
+ %AddProperty(prototype, fields[i], UNDEFINED, DONT_ENUM | DONT_DELETE);
}
}
for (var i = 0; i < methods.length; i += 2) {
var key = methods[i];
var f = methods[i + 1];
- %SetProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
+ %AddProperty(prototype, key, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetNativeFlag(f);
}
%SetPrototype(prototype, null);
@@ -190,13 +190,13 @@ function SetUpGlobal() {
var attributes = DONT_ENUM | DONT_DELETE | READ_ONLY;
// ECMA 262 - 15.1.1.1.
- %SetProperty(global, "NaN", NAN, attributes);
+ %AddProperty(global, "NaN", NAN, attributes);
// ECMA-262 - 15.1.1.2.
- %SetProperty(global, "Infinity", INFINITY, attributes);
+ %AddProperty(global, "Infinity", INFINITY, attributes);
// ECMA-262 - 15.1.1.3.
- %SetProperty(global, "undefined", UNDEFINED, attributes);
+ %AddProperty(global, "undefined", UNDEFINED, attributes);
// Set up non-enumerable function on the global object.
InstallFunctions(global, DONT_ENUM, $Array(
@@ -386,24 +386,22 @@ function FromGenericPropertyDescriptor(desc) {
var obj = new $Object();
if (desc.hasValue()) {
- %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
+ %AddProperty(obj, "value", desc.getValue(), NONE);
}
if (desc.hasWritable()) {
- %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
+ %AddProperty(obj, "writable", desc.isWritable(), NONE);
}
if (desc.hasGetter()) {
- %IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
+ %AddProperty(obj, "get", desc.getGet(), NONE);
}
if (desc.hasSetter()) {
- %IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
+ %AddProperty(obj, "set", desc.getSet(), NONE);
}
if (desc.hasEnumerable()) {
- %IgnoreAttributesAndSetProperty(obj, "enumerable",
- desc.isEnumerable(), NONE);
+ %AddProperty(obj, "enumerable", desc.isEnumerable(), NONE);
}
if (desc.hasConfigurable()) {
- %IgnoreAttributesAndSetProperty(obj, "configurable",
- desc.isConfigurable(), NONE);
+ %AddProperty(obj, "configurable", desc.isConfigurable(), NONE);
}
return obj;
}
@@ -833,7 +831,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
value = current.getValue();
}
- %DefineOrRedefineDataProperty(obj, p, value, flag);
+ %DefineDataPropertyUnchecked(obj, p, value, flag);
} else {
// There are 3 cases that lead here:
// Step 4b - defining a new accessor property.
@@ -843,7 +841,7 @@ function DefineObjectProperty(obj, p, desc, should_throw) {
// descriptor.
var getter = desc.hasGetter() ? desc.getGet() : null;
var setter = desc.hasSetter() ? desc.getSet() : null;
- %DefineOrRedefineAccessorProperty(obj, p, getter, setter, flag);
+ %DefineAccessorPropertyUnchecked(obj, p, getter, setter, flag);
}
return true;
}
@@ -901,7 +899,7 @@ function DefineArrayProperty(obj, p, desc, should_throw) {
// Make sure the below call to DefineObjectProperty() doesn't overwrite
// any magic "length" property by removing the value.
// TODO(mstarzinger): This hack should be removed once we have addressed the
- // respective TODO in Runtime_DefineOrRedefineDataProperty.
+ // respective TODO in Runtime_DefineDataPropertyUnchecked.
// For the time being, we need a hack to prevent Object.observe from
// generating two change records.
obj.length = new_length;
@@ -1397,7 +1395,7 @@ function SetUpObject() {
%SetNativeFlag($Object);
%SetCode($Object, ObjectConstructor);
- %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
+ %AddProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
// Set up non-enumerable functions on the Object.prototype object.
InstallFunctions($Object.prototype, DONT_ENUM, $Array(
@@ -1484,7 +1482,7 @@ function SetUpBoolean () {
%SetCode($Boolean, BooleanConstructor);
%FunctionSetPrototype($Boolean, new $Boolean(false));
- %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
+ %AddProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
"toString", BooleanToString,
@@ -1667,7 +1665,7 @@ function SetUpNumber() {
%OptimizeObjectForAddingMultipleProperties($Number.prototype, 8);
// Set up the constructor property on the Number prototype object.
- %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
+ %AddProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
InstallConstants($Number, $Array(
// ECMA-262 section 15.7.3.1.
@@ -1850,7 +1848,7 @@ function SetUpFunction() {
%CheckIsBootstrapping();
%SetCode($Function, FunctionConstructor);
- %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
+ %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
"bind", FunctionBind,
« no previous file with comments | « src/typedarray.js ('k') | src/weak_collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698