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

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

Issue 2237983004: Merged: Squashed multiple commits. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.3
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 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2313
2314 LoadGlobalICNexus nexus(vector, vector_slot); 2314 LoadGlobalICNexus nexus(vector, vector_slot);
2315 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2315 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2316 ic.UpdateState(global, name); 2316 ic.UpdateState(global, name);
2317 2317
2318 Handle<Object> result; 2318 Handle<Object> result;
2319 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name)); 2319 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name));
2320 return *result; 2320 return *result;
2321 } 2321 }
2322 2322
2323 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
2324 HandleScope scope(isolate);
2325 DCHECK_EQ(2, args.length());
2326 CONVERT_SMI_ARG_CHECKED(slot, 0);
2327 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
2328
2329 FeedbackVectorSlot vector_slot = vector->ToSlot(slot);
2330 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
2331 vector->GetKind(vector_slot));
2332 Handle<String> name(vector->GetName(vector_slot), isolate);
2333 DCHECK_NE(*name, *isolate->factory()->empty_string());
2334
2335 Handle<JSGlobalObject> global = isolate->global_object();
2336
2337 Handle<ScriptContextTable> script_contexts(
2338 global->native_context()->script_context_table());
2339
2340 ScriptContextTable::LookupResult lookup_result;
2341 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
2342 Handle<Context> script_context = ScriptContextTable::GetContext(
2343 script_contexts, lookup_result.context_index);
2344 Handle<Object> result =
2345 FixedArray::get(*script_context, lookup_result.slot_index, isolate);
2346 if (*result == *isolate->factory()->the_hole_value()) {
2347 THROW_NEW_ERROR_RETURN_FAILURE(
2348 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2349 }
2350 return *result;
2351 }
2352
2353 Handle<Object> result;
2354 bool is_found = false;
2355 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2356 isolate, result,
2357 Runtime::GetObjectProperty(isolate, global, name, &is_found));
2358 if (!is_found) {
2359 LoadICNexus nexus(isolate);
2360 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2361 // It is actually a LoadGlobalICs here but the predicate handles this case
2362 // properly.
2363 if (ic.ShouldThrowReferenceError()) {
2364 THROW_NEW_ERROR_RETURN_FAILURE(
2365 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2366 }
2367 }
2368 return *result;
2369 }
2370
2323 // Used from ic-<arch>.cc 2371 // Used from ic-<arch>.cc
2324 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { 2372 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
2325 TimerEventScope<TimerEventIcMiss> timer(isolate); 2373 TimerEventScope<TimerEventIcMiss> timer(isolate);
2326 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2374 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2327 HandleScope scope(isolate); 2375 HandleScope scope(isolate);
2328 Handle<Object> receiver = args.at<Object>(0); 2376 Handle<Object> receiver = args.at<Object>(0);
2329 Handle<Object> key = args.at<Object>(1); 2377 Handle<Object> key = args.at<Object>(1);
2330 2378
2331 DCHECK(args.length() == 4); 2379 DCHECK(args.length() == 4);
2332 Handle<Smi> slot = args.at<Smi>(2); 2380 Handle<Smi> slot = args.at<Smi>(2);
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 3041 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2994 vector->GetKind(vector_slot)); 3042 vector->GetKind(vector_slot));
2995 KeyedLoadICNexus nexus(vector, vector_slot); 3043 KeyedLoadICNexus nexus(vector, vector_slot);
2996 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 3044 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2997 ic.UpdateState(receiver, key); 3045 ic.UpdateState(receiver, key);
2998 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 3046 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2999 } 3047 }
3000 } 3048 }
3001 } // namespace internal 3049 } // namespace internal
3002 } // namespace v8 3050 } // 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