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

Side by Side 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: Rebasing 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 unified diff | Download patch
« src/ic/ic.h ('K') | « src/ic/ic.h ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2977 LookupIterator it(receiver, name, holder, LookupIterator::OWN); 2977 LookupIterator it(receiver, name, holder, LookupIterator::OWN);
2978 bool done; 2978 bool done;
2979 Handle<Object> result; 2979 Handle<Object> result;
2980 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2980 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2981 isolate, result, JSObject::GetPropertyWithInterceptor(&it, &done)); 2981 isolate, result, JSObject::GetPropertyWithInterceptor(&it, &done));
2982 if (done) return *result; 2982 if (done) return *result;
2983 return isolate->heap()->no_interceptor_result_sentinel(); 2983 return isolate->heap()->no_interceptor_result_sentinel();
2984 } 2984 }
2985 2985
2986 2986
2987 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { 2987 static Object* ThrowReferenceError(Isolate* isolate, LookupIterator* it) {
2988 // If the load is non-contextual, just return the undefined result. 2988 // If it's not load of an undeclared global, just return the undefined result.
2989 // Note that both keyed and non-keyed loads may end up here. 2989 // Note that both keyed and non-keyed loads may end up here.
2990 HandleScope scope(isolate); 2990 HandleScope scope(isolate);
2991 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); 2991 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true);
2992 if (ic.contextual_mode() != CONTEXTUAL) { 2992 if (!ic.IsUndeclaredGlobal(it->GetReceiver())) {
2993 return isolate->heap()->undefined_value(); 2993 return isolate->heap()->undefined_value();
2994 } 2994 }
2995 2995
2996 // Throw a reference error. 2996 // Throw a reference error.
2997 Handle<Name> name_handle(name);
2998 THROW_NEW_ERROR_RETURN_FAILURE( 2997 THROW_NEW_ERROR_RETURN_FAILURE(
2999 isolate, NewReferenceError(MessageTemplate::kNotDefined, name_handle)); 2998 isolate, NewReferenceError(MessageTemplate::kNotDefined, it->name()));
3000 } 2999 }
3001 3000
3002 3001
3003 /** 3002 /**
3004 * Loads a property with an interceptor performing post interceptor 3003 * Loads a property with an interceptor performing post interceptor
3005 * lookup if interceptor failed. 3004 * lookup if interceptor failed.
3006 */ 3005 */
3007 RUNTIME_FUNCTION(LoadPropertyWithInterceptor) { 3006 RUNTIME_FUNCTION(LoadPropertyWithInterceptor) {
3008 HandleScope scope(isolate); 3007 HandleScope scope(isolate);
3009 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 3008 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength);
3010 Handle<Name> name = 3009 Handle<Name> name =
3011 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 3010 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
3012 Handle<JSObject> receiver = 3011 Handle<JSObject> receiver =
3013 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 3012 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
3014 Handle<JSObject> holder = 3013 Handle<JSObject> holder =
3015 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 3014 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
3016 3015
3017 Handle<Object> result; 3016 Handle<Object> result;
3018 LookupIterator it(receiver, name, holder); 3017 LookupIterator it(receiver, name, holder);
3019 // TODO(conradw): Investigate strong mode semantics for this. 3018 // TODO(conradw): Investigate strong mode semantics for this.
3020 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3019 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3021 JSObject::GetProperty(&it)); 3020 JSObject::GetProperty(&it));
3022 3021
3023 if (it.IsFound()) return *result; 3022 if (it.IsFound()) return *result;
3024 3023
3025 return ThrowReferenceError(isolate, Name::cast(args[0])); 3024 return ThrowReferenceError(isolate, &it);
Toon Verwaest 2015/07/13 12:56:03 Just inline the helper method here, if it's the on
Igor Sheludko 2015/07/13 13:08:02 Done.
3026 } 3025 }
3027 3026
3028 3027
3029 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { 3028 RUNTIME_FUNCTION(StorePropertyWithInterceptor) {
3030 HandleScope scope(isolate); 3029 HandleScope scope(isolate);
3031 DCHECK(args.length() == 3); 3030 DCHECK(args.length() == 3);
3032 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); 3031 StoreIC ic(IC::NO_EXTRA_FRAME, isolate);
3033 Handle<JSObject> receiver = args.at<JSObject>(0); 3032 Handle<JSObject> receiver = args.at<JSObject>(0);
3034 Handle<Name> name = args.at<Name>(1); 3033 Handle<Name> name = args.at<Name>(1);
3035 Handle<Object> value = args.at<Object>(2); 3034 Handle<Object> value = args.at<Object>(2);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3105 static const Address IC_utilities[] = { 3104 static const Address IC_utilities[] = {
3106 #define ADDR(name) FUNCTION_ADDR(name), 3105 #define ADDR(name) FUNCTION_ADDR(name),
3107 IC_UTIL_LIST(ADDR) NULL 3106 IC_UTIL_LIST(ADDR) NULL
3108 #undef ADDR 3107 #undef ADDR
3109 }; 3108 };
3110 3109
3111 3110
3112 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3111 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3113 } // namespace internal 3112 } // namespace internal
3114 } // namespace v8 3113 } // namespace v8
OLDNEW
« src/ic/ic.h ('K') | « 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