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

Unified Diff: src/ic/ic.cc

Issue 1227893005: TypeofMode replaces TypeofState and ContextualMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 5 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/ic.h ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 4006f296a10b5503e708c0151866aba8d8756a7b..d199aca7369ec488cc25c0ac3636d5b0e43d885e 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -734,7 +734,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
LookupIterator it(object, name);
LookupForRead(&it);
- if (it.IsFound() || !IsUndeclaredGlobal(object)) {
+ if (it.IsFound() || !ShouldThrowReferenceError(object)) {
// Update inline cache and stub cache.
if (use_ic) UpdateCaches(&it);
@@ -745,7 +745,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
isolate(), result, Object::GetProperty(&it, language_mode()), Object);
if (it.IsFound()) {
return result;
- } else if (!IsUndeclaredGlobal(object)) {
+ } else if (!ShouldThrowReferenceError(object)) {
LOG(isolate(), SuspectReadEvent(*name, *object));
return result;
}
@@ -2984,22 +2984,6 @@ RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly) {
}
-static Object* ThrowReferenceError(Isolate* isolate, Name* name) {
- // If the load is non-contextual, just return the undefined result.
- // Note that both keyed and non-keyed loads may end up here.
- HandleScope scope(isolate);
- LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
- if (ic.contextual_mode() != CONTEXTUAL) {
- return isolate->heap()->undefined_value();
- }
-
- // Throw a reference error.
- Handle<Name> name_handle(name);
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate, NewReferenceError(MessageTemplate::kNotDefined, name_handle));
-}
-
-
/**
* Loads a property with an interceptor performing post interceptor
* lookup if interceptor failed.
@@ -3022,7 +3006,16 @@ RUNTIME_FUNCTION(LoadPropertyWithInterceptor) {
if (it.IsFound()) return *result;
- return ThrowReferenceError(isolate, Name::cast(args[0]));
+ // Return the undefined result if the reference error should not be thrown.
+ // Note that both keyed and non-keyed loads may end up here.
+ LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
+ if (!ic.ShouldThrowReferenceError(it.GetReceiver())) {
+ return isolate->heap()->undefined_value();
+ }
+
+ // Throw a reference error.
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name()));
}
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698