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

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

Issue 2220203002: [ic] Merge LoadGlobalIC_Slow builtins for inside typeof and outside typeof cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/runtime/runtime.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 "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-arguments-inl.h" 8 #include "src/api-arguments-inl.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2306
2307 LoadGlobalICNexus nexus(vector, vector_slot); 2307 LoadGlobalICNexus nexus(vector, vector_slot);
2308 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2308 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2309 ic.UpdateState(global, name); 2309 ic.UpdateState(global, name);
2310 2310
2311 Handle<Object> result; 2311 Handle<Object> result;
2312 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name)); 2312 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name));
2313 return *result; 2313 return *result;
2314 } 2314 }
2315 2315
2316 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
2317 HandleScope scope(isolate);
2318 DCHECK_EQ(2, args.length());
2319 CONVERT_SMI_ARG_CHECKED(slot, 0);
2320 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
2321
2322 FeedbackVectorSlot vector_slot = vector->ToSlot(slot);
2323 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
2324 vector->GetKind(vector_slot));
2325 Handle<String> name(vector->GetName(vector_slot), isolate);
2326 DCHECK_NE(*name, *isolate->factory()->empty_string());
2327
2328 Handle<JSGlobalObject> global = isolate->global_object();
2329
2330 Handle<ScriptContextTable> script_contexts(
2331 global->native_context()->script_context_table());
2332
2333 ScriptContextTable::LookupResult lookup_result;
2334 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
2335 Handle<Context> script_context = ScriptContextTable::GetContext(
2336 script_contexts, lookup_result.context_index);
2337 Handle<Object> result =
2338 FixedArray::get(*script_context, lookup_result.slot_index, isolate);
2339 if (*result == *isolate->factory()->the_hole_value()) {
2340 THROW_NEW_ERROR_RETURN_FAILURE(
2341 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2342 }
2343 return *result;
2344 }
2345
2346 Handle<Object> result;
2347 bool is_found = false;
2348 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2349 isolate, result,
2350 Runtime::GetObjectProperty(isolate, global, name, &is_found));
2351 if (!is_found) {
2352 LoadICNexus nexus(isolate);
2353 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2354 // It is actually a LoadGlobalICs here but the predicate handles this case
2355 // properly.
2356 if (ic.ShouldThrowReferenceError()) {
2357 THROW_NEW_ERROR_RETURN_FAILURE(
2358 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2359 }
2360 }
2361 return *result;
2362 }
2363
2316 // Used from ic-<arch>.cc 2364 // Used from ic-<arch>.cc
2317 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { 2365 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
2318 TimerEventScope<TimerEventIcMiss> timer(isolate); 2366 TimerEventScope<TimerEventIcMiss> timer(isolate);
2319 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2367 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2320 HandleScope scope(isolate); 2368 HandleScope scope(isolate);
2321 Handle<Object> receiver = args.at<Object>(0); 2369 Handle<Object> receiver = args.at<Object>(0);
2322 Handle<Object> key = args.at<Object>(1); 2370 Handle<Object> key = args.at<Object>(1);
2323 2371
2324 DCHECK(args.length() == 4); 2372 DCHECK(args.length() == 4);
2325 Handle<Smi> slot = args.at<Smi>(2); 2373 Handle<Smi> slot = args.at<Smi>(2);
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 3039 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2992 vector->GetKind(vector_slot)); 3040 vector->GetKind(vector_slot));
2993 KeyedLoadICNexus nexus(vector, vector_slot); 3041 KeyedLoadICNexus nexus(vector, vector_slot);
2994 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 3042 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2995 ic.UpdateState(receiver, key); 3043 ic.UpdateState(receiver, key);
2996 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 3044 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2997 } 3045 }
2998 } 3046 }
2999 } // namespace internal 3047 } // namespace internal
3000 } // namespace v8 3048 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698