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

Unified Diff: src/ic.cc

Issue 12040039: Always fail when trying to store to an undeclared global variable, even if it was found. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix test to check for the exact reference error. Created 7 years, 11 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/ic.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index b7598784b67d666c63afd102e06deb7b710d403d..5e8e0e060e633154b3faf7ffc9a0ac15fc57e0af 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -542,7 +542,7 @@ MaybeObject* CallICBase::LoadFunction(State state,
if (!lookup.IsFound()) {
// If the object does not have the requested property, check which
// exception we need to throw.
- return IsContextual(object)
+ return IsUndeclaredGlobal(object)
? ReferenceError("not_defined", name)
: TypeError("undefined_method", object, name);
}
@@ -561,7 +561,7 @@ MaybeObject* CallICBase::LoadFunction(State state,
if (lookup.IsInterceptor() && attr == ABSENT) {
// If the object does not have the requested property, check which
// exception we need to throw.
- return IsContextual(object)
+ return IsUndeclaredGlobal(object)
? ReferenceError("not_defined", name)
: TypeError("undefined_method", object, name);
}
@@ -933,7 +933,7 @@ MaybeObject* LoadIC::Load(State state,
// If we did not find a property, check if we need to throw an exception.
if (!lookup.IsFound()) {
- if (IsContextual(object)) {
+ if (IsUndeclaredGlobal(object)) {
return ReferenceError("not_defined", name);
}
LOG(isolate(), SuspectReadEvent(*name, *object));
@@ -952,7 +952,7 @@ MaybeObject* LoadIC::Load(State state,
RETURN_IF_EMPTY_HANDLE(isolate(), result);
// If the property is not present, check if we need to throw an
// exception.
- if (attr == ABSENT && IsContextual(object)) {
+ if (attr == ABSENT && IsUndeclaredGlobal(object)) {
return ReferenceError("not_defined", name);
}
return *result;
@@ -1463,11 +1463,8 @@ MaybeObject* StoreIC::Store(State state,
if (FLAG_use_ic) {
UpdateStoreCaches(&lookup, state, strict_mode, receiver, name, value);
}
- } else if (strict_mode == kStrictMode &&
- !lookup.IsFound() &&
- IsContextual(object)) {
- // Strict mode doesn't allow setting non-existent global property
- // or an assignment to a read only property.
+ } else if (strict_mode == kStrictMode && IsUndeclaredGlobal(object)) {
+ // Strict mode doesn't allow setting non-existent global property.
return ReferenceError("not_defined", name);
}
« no previous file with comments | « src/ic.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698