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

Unified Diff: src/v8natives.js

Issue 7071009: Revert "Pass undefined to JS builtins when called with implicit receiver." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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/runtime.cc ('k') | src/x64/builtins-x64.cc » ('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 469059ba21a3981a8e1c6b9d5e9db057f74f098d..d22e94d85ee5416bfdab7d48ae5e23b469084858 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -56,7 +56,7 @@ function InstallFunctions(object, attributes, functions) {
%FunctionSetName(f, key);
%FunctionRemovePrototype(f);
%SetProperty(object, key, f, attributes);
- %SetNativeFlag(f);
+ %SetES5Flag(f);
}
%ToFastProperties(object);
}
@@ -132,19 +132,10 @@ function GlobalParseFloat(string) {
function GlobalEval(x) {
if (!IS_STRING(x)) return x;
- var receiver = this;
var global_receiver = %GlobalReceiver(global);
-
- if (receiver == null && !IS_UNDETECTABLE(receiver)) {
- receiver = global_receiver;
- }
-
- var this_is_global_receiver = (receiver === global_receiver);
+ var this_is_global_receiver = (this === global_receiver);
var global_is_detached = (global === global_receiver);
- // For consistency with JSC we require the global object passed to
- // eval to be the global object from which 'eval' originated. This
- // is not mandated by the spec.
if (!this_is_global_receiver || global_is_detached) {
throw new $EvalError('The "this" object passed to eval must ' +
'be the global object from which eval originated');
@@ -153,7 +144,7 @@ function GlobalEval(x) {
var f = %CompileString(x);
if (!IS_FUNCTION(f)) return f;
- return %_CallFunction(receiver, f);
+ return %_CallFunction(this, f);
}
@@ -255,9 +246,8 @@ function ObjectPropertyIsEnumerable(V) {
// Extensions for providing property getters and setters.
function ObjectDefineGetter(name, fun) {
- var receiver = this;
- if (receiver == null && !IS_UNDETECTABLE(receiver)) {
- receiver = %GlobalReceiver(global);
+ if (this == null && !IS_UNDETECTABLE(this)) {
+ throw new $TypeError('Object.prototype.__defineGetter__: this is Null');
}
if (!IS_FUNCTION(fun)) {
throw new $TypeError('Object.prototype.__defineGetter__: Expecting function');
@@ -266,23 +256,21 @@ function ObjectDefineGetter(name, fun) {
desc.setGet(fun);
desc.setEnumerable(true);
desc.setConfigurable(true);
- DefineOwnProperty(ToObject(receiver), ToString(name), desc, false);
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
}
function ObjectLookupGetter(name) {
- var receiver = this;
- if (receiver == null && !IS_UNDETECTABLE(receiver)) {
- receiver = %GlobalReceiver(global);
+ if (this == null && !IS_UNDETECTABLE(this)) {
+ throw new $TypeError('Object.prototype.__lookupGetter__: this is Null');
}
- return %LookupAccessor(ToObject(receiver), ToString(name), GETTER);
+ return %LookupAccessor(ToObject(this), ToString(name), GETTER);
}
function ObjectDefineSetter(name, fun) {
- var receiver = this;
- if (receiver == null && !IS_UNDETECTABLE(receiver)) {
- receiver = %GlobalReceiver(global);
+ if (this == null && !IS_UNDETECTABLE(this)) {
+ throw new $TypeError('Object.prototype.__defineSetter__: this is Null');
}
if (!IS_FUNCTION(fun)) {
throw new $TypeError(
@@ -292,16 +280,15 @@ function ObjectDefineSetter(name, fun) {
desc.setSet(fun);
desc.setEnumerable(true);
desc.setConfigurable(true);
- DefineOwnProperty(ToObject(receiver), ToString(name), desc, false);
+ DefineOwnProperty(ToObject(this), ToString(name), desc, false);
}
function ObjectLookupSetter(name) {
- var receiver = this;
- if (receiver == null && !IS_UNDETECTABLE(receiver)) {
- receiver = %GlobalReceiver(global);
+ if (this == null && !IS_UNDETECTABLE(this)) {
+ throw new $TypeError('Object.prototype.__lookupSetter__: this is Null');
}
- return %LookupAccessor(ToObject(receiver), ToString(name), SETTER);
+ return %LookupAccessor(ToObject(this), ToString(name), SETTER);
}
« no previous file with comments | « src/runtime.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698