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

Side by Side Diff: src/ic/ic.cc

Issue 2673383002: [ic] Encode LoadGlobalIC's typeof mode in slot kind instead of code object's flags. (Closed)
Patch Set: Addressed comments and added check to FCG Created 3 years, 10 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
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-state.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/ic/ic.h" 5 #include "src/ic/ic.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/api-arguments-inl.h" 10 #include "src/api-arguments-inl.h"
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2545 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2546 ic.UpdateState(global, name); 2546 ic.UpdateState(global, name);
2547 2547
2548 Handle<Object> result; 2548 Handle<Object> result;
2549 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name)); 2549 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name));
2550 return *result; 2550 return *result;
2551 } 2551 }
2552 2552
2553 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) { 2553 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
2554 HandleScope scope(isolate); 2554 HandleScope scope(isolate);
2555 DCHECK_EQ(1, args.length()); 2555 DCHECK_EQ(3, args.length());
2556 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 2556 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
2557 2557
2558 Handle<Context> native_context = isolate->native_context(); 2558 Handle<Context> native_context = isolate->native_context();
2559 Handle<ScriptContextTable> script_contexts( 2559 Handle<ScriptContextTable> script_contexts(
2560 native_context->script_context_table()); 2560 native_context->script_context_table());
2561 2561
2562 ScriptContextTable::LookupResult lookup_result; 2562 ScriptContextTable::LookupResult lookup_result;
2563 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) { 2563 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
2564 Handle<Context> script_context = ScriptContextTable::GetContext( 2564 Handle<Context> script_context = ScriptContextTable::GetContext(
2565 script_contexts, lookup_result.context_index); 2565 script_contexts, lookup_result.context_index);
2566 Handle<Object> result = 2566 Handle<Object> result =
2567 FixedArray::get(*script_context, lookup_result.slot_index, isolate); 2567 FixedArray::get(*script_context, lookup_result.slot_index, isolate);
2568 if (*result == isolate->heap()->the_hole_value()) { 2568 if (*result == isolate->heap()->the_hole_value()) {
2569 THROW_NEW_ERROR_RETURN_FAILURE( 2569 THROW_NEW_ERROR_RETURN_FAILURE(
2570 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); 2570 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2571 } 2571 }
2572 return *result; 2572 return *result;
2573 } 2573 }
2574 2574
2575 Handle<JSGlobalObject> global(native_context->global_object(), isolate); 2575 Handle<JSGlobalObject> global(native_context->global_object(), isolate);
2576 Handle<Object> result; 2576 Handle<Object> result;
2577 bool is_found = false; 2577 bool is_found = false;
2578 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2578 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2579 isolate, result, 2579 isolate, result,
2580 Runtime::GetObjectProperty(isolate, global, name, &is_found)); 2580 Runtime::GetObjectProperty(isolate, global, name, &is_found));
2581 if (!is_found) { 2581 if (!is_found) {
2582 LoadICNexus nexus(isolate); 2582 Handle<Smi> slot = args.at<Smi>(1);
2583 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2583 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2);
2584 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2585 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot);
2584 // It is actually a LoadGlobalICs here but the predicate handles this case 2586 // It is actually a LoadGlobalICs here but the predicate handles this case
2585 // properly. 2587 // properly.
2586 if (ic.ShouldThrowReferenceError()) { 2588 if (LoadIC::ShouldThrowReferenceError(kind)) {
2587 THROW_NEW_ERROR_RETURN_FAILURE( 2589 THROW_NEW_ERROR_RETURN_FAILURE(
2588 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); 2590 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2589 } 2591 }
2590 } 2592 }
2591 return *result; 2593 return *result;
2592 } 2594 }
2593 2595
2594 // Used from ic-<arch>.cc 2596 // Used from ic-<arch>.cc
2595 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { 2597 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
2596 HandleScope scope(isolate); 2598 HandleScope scope(isolate);
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 return isolate->heap()->no_interceptor_result_sentinel(); 3025 return isolate->heap()->no_interceptor_result_sentinel();
3024 } 3026 }
3025 3027
3026 3028
3027 /** 3029 /**
3028 * Loads a property with an interceptor performing post interceptor 3030 * Loads a property with an interceptor performing post interceptor
3029 * lookup if interceptor failed. 3031 * lookup if interceptor failed.
3030 */ 3032 */
3031 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) { 3033 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) {
3032 HandleScope scope(isolate); 3034 HandleScope scope(isolate);
3033 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); 3035 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength + 2);
3034 Handle<Name> name = 3036 Handle<Name> name =
3035 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); 3037 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex);
3036 Handle<Object> receiver = 3038 Handle<Object> receiver =
3037 args.at(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); 3039 args.at(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex);
3038 Handle<JSObject> holder = 3040 Handle<JSObject> holder =
3039 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); 3041 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
3040 3042
3041 if (!receiver->IsJSReceiver()) { 3043 if (!receiver->IsJSReceiver()) {
3042 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 3044 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
3043 isolate, receiver, Object::ConvertReceiver(isolate, receiver)); 3045 isolate, receiver, Object::ConvertReceiver(isolate, receiver));
(...skipping 18 matching lines...) Expand all
3062 !it.GetHolder<JSObject>().is_identical_to(holder)) { 3064 !it.GetHolder<JSObject>().is_identical_to(holder)) {
3063 DCHECK(it.state() != LookupIterator::ACCESS_CHECK || it.HasAccess()); 3065 DCHECK(it.state() != LookupIterator::ACCESS_CHECK || it.HasAccess());
3064 it.Next(); 3066 it.Next();
3065 } 3067 }
3066 // Skip past the interceptor. 3068 // Skip past the interceptor.
3067 it.Next(); 3069 it.Next();
3068 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); 3070 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it));
3069 3071
3070 if (it.IsFound()) return *result; 3072 if (it.IsFound()) return *result;
3071 3073
3072 LoadICNexus nexus(isolate); 3074 Handle<Smi> slot = args.at<Smi>(3);
3073 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 3075 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
3074 // It could actually be any kind of LoadICs here but the predicate handles 3076 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
3075 // all the cases properly. 3077 FeedbackVectorSlotKind slot_kind = vector->GetKind(vector_slot);
3076 if (!ic.ShouldThrowReferenceError()) { 3078 // It could actually be any kind of load IC slot here but the predicate
3079 // handles all the cases properly.
3080 if (!LoadIC::ShouldThrowReferenceError(slot_kind)) {
3077 return isolate->heap()->undefined_value(); 3081 return isolate->heap()->undefined_value();
3078 } 3082 }
3079 3083
3080 // Throw a reference error. 3084 // Throw a reference error.
3081 THROW_NEW_ERROR_RETURN_FAILURE( 3085 THROW_NEW_ERROR_RETURN_FAILURE(
3082 isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name())); 3086 isolate, NewReferenceError(MessageTemplate::kNotDefined, it.name()));
3083 } 3087 }
3084 3088
3085 3089
3086 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) { 3090 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3151 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3148 it.Next(); 3152 it.Next();
3149 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3153 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3150 Object::GetProperty(&it)); 3154 Object::GetProperty(&it));
3151 } 3155 }
3152 3156
3153 return *result; 3157 return *result;
3154 } 3158 }
3155 } // namespace internal 3159 } // namespace internal
3156 } // namespace v8 3160 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698