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

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

Issue 2006673002: Reduce boilerplace for common pattern to return MaybeHandle. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and fix Created 4 years, 7 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/builtins.cc ('k') | src/isolate.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.h" 8 #include "src/api.h"
9 #include "src/api-arguments.h" 9 #include "src/api-arguments.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 } 2252 }
2253 2253
2254 2254
2255 // Used from ic-<arch>.cc. 2255 // Used from ic-<arch>.cc.
2256 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) { 2256 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
2257 TimerEventScope<TimerEventIcMiss> timer(isolate); 2257 TimerEventScope<TimerEventIcMiss> timer(isolate);
2258 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2258 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2259 HandleScope scope(isolate); 2259 HandleScope scope(isolate);
2260 Handle<Object> receiver = args.at<Object>(0); 2260 Handle<Object> receiver = args.at<Object>(0);
2261 Handle<Name> key = args.at<Name>(1); 2261 Handle<Name> key = args.at<Name>(1);
2262 Handle<Object> result;
2263 2262
2264 DCHECK(args.length() == 4); 2263 DCHECK(args.length() == 4);
2265 Handle<Smi> slot = args.at<Smi>(2); 2264 Handle<Smi> slot = args.at<Smi>(2);
2266 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2265 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2267 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2266 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2268 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the 2267 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the
2269 // LoadIC miss handler if the handler misses. Since the vector Nexus is 2268 // LoadIC miss handler if the handler misses. Since the vector Nexus is
2270 // set up outside the IC, handle that here. 2269 // set up outside the IC, handle that here.
2271 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) { 2270 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) {
2272 LoadICNexus nexus(vector, vector_slot); 2271 LoadICNexus nexus(vector, vector_slot);
2273 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2272 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2274 ic.UpdateState(receiver, key); 2273 ic.UpdateState(receiver, key);
2275 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2274 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2276 } else { 2275 } else {
2277 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2276 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2278 vector->GetKind(vector_slot)); 2277 vector->GetKind(vector_slot));
2279 KeyedLoadICNexus nexus(vector, vector_slot); 2278 KeyedLoadICNexus nexus(vector, vector_slot);
2280 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2279 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2281 ic.UpdateState(receiver, key); 2280 ic.UpdateState(receiver, key);
2282 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2281 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2283 } 2282 }
2284 return *result;
2285 } 2283 }
2286 2284
2287 2285
2288 // Used from ic-<arch>.cc 2286 // Used from ic-<arch>.cc
2289 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { 2287 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) {
2290 TimerEventScope<TimerEventIcMiss> timer(isolate); 2288 TimerEventScope<TimerEventIcMiss> timer(isolate);
2291 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2289 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2292 HandleScope scope(isolate); 2290 HandleScope scope(isolate);
2293 Handle<Object> receiver = args.at<Object>(0); 2291 Handle<Object> receiver = args.at<Object>(0);
2294 Handle<Object> key = args.at<Object>(1); 2292 Handle<Object> key = args.at<Object>(1);
2295 Handle<Object> result;
2296 2293
2297 DCHECK(args.length() == 4); 2294 DCHECK(args.length() == 4);
2298 Handle<Smi> slot = args.at<Smi>(2); 2295 Handle<Smi> slot = args.at<Smi>(2);
2299 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2296 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2300 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2297 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2301 KeyedLoadICNexus nexus(vector, vector_slot); 2298 KeyedLoadICNexus nexus(vector, vector_slot);
2302 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2299 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2303 ic.UpdateState(receiver, key); 2300 ic.UpdateState(receiver, key);
2304 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2301 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2305 return *result;
2306 } 2302 }
2307 2303
2308 2304
2309 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) { 2305 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
2310 TimerEventScope<TimerEventIcMiss> timer(isolate); 2306 TimerEventScope<TimerEventIcMiss> timer(isolate);
2311 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2307 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2312 HandleScope scope(isolate); 2308 HandleScope scope(isolate);
2313 Handle<Object> receiver = args.at<Object>(0); 2309 Handle<Object> receiver = args.at<Object>(0);
2314 Handle<Object> key = args.at<Object>(1); 2310 Handle<Object> key = args.at<Object>(1);
2315 Handle<Object> result;
2316 2311
2317 DCHECK(args.length() == 4); 2312 DCHECK(args.length() == 4);
2318 Handle<Smi> slot = args.at<Smi>(2); 2313 Handle<Smi> slot = args.at<Smi>(2);
2319 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2314 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2320 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2315 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2321 KeyedLoadICNexus nexus(vector, vector_slot); 2316 KeyedLoadICNexus nexus(vector, vector_slot);
2322 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2317 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2323 ic.UpdateState(receiver, key); 2318 ic.UpdateState(receiver, key);
2324 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2319 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2325
2326 return *result;
2327 } 2320 }
2328 2321
2329 2322
2330 // Used from ic-<arch>.cc. 2323 // Used from ic-<arch>.cc.
2331 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { 2324 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
2332 TimerEventScope<TimerEventIcMiss> timer(isolate); 2325 TimerEventScope<TimerEventIcMiss> timer(isolate);
2333 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2326 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2334 HandleScope scope(isolate); 2327 HandleScope scope(isolate);
2335 Handle<Object> receiver = args.at<Object>(0); 2328 Handle<Object> receiver = args.at<Object>(0);
2336 Handle<Name> key = args.at<Name>(1); 2329 Handle<Name> key = args.at<Name>(1);
2337 Handle<Object> value = args.at<Object>(2); 2330 Handle<Object> value = args.at<Object>(2);
2338 Handle<Object> result;
2339 2331
2340 DCHECK(args.length() == 5 || args.length() == 6); 2332 DCHECK(args.length() == 5 || args.length() == 6);
2341 Handle<Smi> slot = args.at<Smi>(3); 2333 Handle<Smi> slot = args.at<Smi>(3);
2342 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); 2334 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
2343 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2335 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2344 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { 2336 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) {
2345 StoreICNexus nexus(vector, vector_slot); 2337 StoreICNexus nexus(vector, vector_slot);
2346 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2338 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2347 ic.UpdateState(receiver, key); 2339 ic.UpdateState(receiver, key);
2348 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2340 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2349 ic.Store(receiver, key, value));
2350 } else { 2341 } else {
2351 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, 2342 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
2352 vector->GetKind(vector_slot)); 2343 vector->GetKind(vector_slot));
2353 KeyedStoreICNexus nexus(vector, vector_slot); 2344 KeyedStoreICNexus nexus(vector, vector_slot);
2354 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2345 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2355 ic.UpdateState(receiver, key); 2346 ic.UpdateState(receiver, key);
2356 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2347 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2357 ic.Store(receiver, key, value));
2358 } 2348 }
2359 return *result;
2360 } 2349 }
2361 2350
2362 2351
2363 RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { 2352 RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
2364 TimerEventScope<TimerEventIcMiss> timer(isolate); 2353 TimerEventScope<TimerEventIcMiss> timer(isolate);
2365 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2354 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2366 HandleScope scope(isolate); 2355 HandleScope scope(isolate);
2367 Handle<Object> receiver = args.at<Object>(0); 2356 Handle<Object> receiver = args.at<Object>(0);
2368 Handle<Name> key = args.at<Name>(1); 2357 Handle<Name> key = args.at<Name>(1);
2369 Handle<Object> value = args.at<Object>(2); 2358 Handle<Object> value = args.at<Object>(2);
2370 Handle<Object> result;
2371 2359
2372 int length = args.length(); 2360 int length = args.length();
2373 DCHECK(length == 5 || length == 6); 2361 DCHECK(length == 5 || length == 6);
2374 // We might have slot and vector, for a normal miss (slot(3), vector(4)). 2362 // We might have slot and vector, for a normal miss (slot(3), vector(4)).
2375 // Or, map and vector for a transitioning store miss (map(3), vector(4)). 2363 // Or, map and vector for a transitioning store miss (map(3), vector(4)).
2376 // In this case, we need to recover the slot from a virtual register. 2364 // In this case, we need to recover the slot from a virtual register.
2377 // If length == 6, then a map is included (map(3), slot(4), vector(5)). 2365 // If length == 6, then a map is included (map(3), slot(4), vector(5)).
2378 Handle<Smi> slot; 2366 Handle<Smi> slot;
2379 Handle<TypeFeedbackVector> vector; 2367 Handle<TypeFeedbackVector> vector;
2380 if (length == 5) { 2368 if (length == 5) {
2381 if (args.at<Object>(3)->IsMap()) { 2369 if (args.at<Object>(3)->IsMap()) {
2382 vector = args.at<TypeFeedbackVector>(4); 2370 vector = args.at<TypeFeedbackVector>(4);
2383 slot = handle( 2371 slot = handle(
2384 *reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()), 2372 *reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()),
2385 isolate); 2373 isolate);
2386 } else { 2374 } else {
2387 vector = args.at<TypeFeedbackVector>(4); 2375 vector = args.at<TypeFeedbackVector>(4);
2388 slot = args.at<Smi>(3); 2376 slot = args.at<Smi>(3);
2389 } 2377 }
2390 } else { 2378 } else {
2391 vector = args.at<TypeFeedbackVector>(5); 2379 vector = args.at<TypeFeedbackVector>(5);
2392 slot = args.at<Smi>(4); 2380 slot = args.at<Smi>(4);
2393 } 2381 }
2394 2382
2395 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2383 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2396 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { 2384 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) {
2397 StoreICNexus nexus(vector, vector_slot); 2385 StoreICNexus nexus(vector, vector_slot);
2398 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2386 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2399 ic.UpdateState(receiver, key); 2387 ic.UpdateState(receiver, key);
2400 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2388 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2401 ic.Store(receiver, key, value));
2402 } else { 2389 } else {
2403 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, 2390 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
2404 vector->GetKind(vector_slot)); 2391 vector->GetKind(vector_slot));
2405 KeyedStoreICNexus nexus(vector, vector_slot); 2392 KeyedStoreICNexus nexus(vector, vector_slot);
2406 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2393 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2407 ic.UpdateState(receiver, key); 2394 ic.UpdateState(receiver, key);
2408 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2395 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2409 ic.Store(receiver, key, value));
2410 } 2396 }
2411 return *result;
2412 } 2397 }
2413 2398
2414 2399
2415 // Used from ic-<arch>.cc. 2400 // Used from ic-<arch>.cc.
2416 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { 2401 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
2417 TimerEventScope<TimerEventIcMiss> timer(isolate); 2402 TimerEventScope<TimerEventIcMiss> timer(isolate);
2418 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2403 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2419 HandleScope scope(isolate); 2404 HandleScope scope(isolate);
2420 Handle<Object> receiver = args.at<Object>(0); 2405 Handle<Object> receiver = args.at<Object>(0);
2421 Handle<Object> key = args.at<Object>(1); 2406 Handle<Object> key = args.at<Object>(1);
2422 Handle<Object> value = args.at<Object>(2); 2407 Handle<Object> value = args.at<Object>(2);
2423 Handle<Object> result;
2424 2408
2425 DCHECK(args.length() == 5); 2409 DCHECK(args.length() == 5);
2426 Handle<Smi> slot = args.at<Smi>(3); 2410 Handle<Smi> slot = args.at<Smi>(3);
2427 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); 2411 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
2428 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2412 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2429 KeyedStoreICNexus nexus(vector, vector_slot); 2413 KeyedStoreICNexus nexus(vector, vector_slot);
2430 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2414 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2431 ic.UpdateState(receiver, key); 2415 ic.UpdateState(receiver, key);
2432 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2416 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2433 ic.Store(receiver, key, value));
2434 return *result;
2435 } 2417 }
2436 2418
2437 2419
2438 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) { 2420 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
2439 TimerEventScope<TimerEventIcMiss> timer(isolate); 2421 TimerEventScope<TimerEventIcMiss> timer(isolate);
2440 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2422 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2441 HandleScope scope(isolate); 2423 HandleScope scope(isolate);
2442 Handle<Object> receiver = args.at<Object>(0); 2424 Handle<Object> receiver = args.at<Object>(0);
2443 Handle<Object> key = args.at<Object>(1); 2425 Handle<Object> key = args.at<Object>(1);
2444 Handle<Object> value = args.at<Object>(2); 2426 Handle<Object> value = args.at<Object>(2);
2445 Handle<Object> result;
2446 2427
2447 DCHECK(args.length() == 5); 2428 DCHECK(args.length() == 5);
2448 Handle<Smi> slot = args.at<Smi>(3); 2429 Handle<Smi> slot = args.at<Smi>(3);
2449 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); 2430 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
2450 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2431 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2451 KeyedStoreICNexus nexus(vector, vector_slot); 2432 KeyedStoreICNexus nexus(vector, vector_slot);
2452 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2433 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2453 ic.UpdateState(receiver, key); 2434 ic.UpdateState(receiver, key);
2454 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 2435 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2455 ic.Store(receiver, key, value));
2456 return *result;
2457 } 2436 }
2458 2437
2459 2438
2460 RUNTIME_FUNCTION(Runtime_StoreIC_Slow) { 2439 RUNTIME_FUNCTION(Runtime_StoreIC_Slow) {
2461 HandleScope scope(isolate); 2440 HandleScope scope(isolate);
2462 DCHECK(args.length() == 5); 2441 DCHECK(args.length() == 5);
2463 Handle<Object> object = args.at<Object>(0); 2442 Handle<Object> object = args.at<Object>(0);
2464 Handle<Object> key = args.at<Object>(1); 2443 Handle<Object> key = args.at<Object>(1);
2465 Handle<Object> value = args.at<Object>(2); 2444 Handle<Object> value = args.at<Object>(2);
2466 LanguageMode language_mode; 2445 LanguageMode language_mode;
2467 StoreICNexus nexus(isolate); 2446 StoreICNexus nexus(isolate);
2468 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2447 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2469 language_mode = ic.language_mode(); 2448 language_mode = ic.language_mode();
2470 Handle<Object> result; 2449 RETURN_RESULT_OR_FAILURE(
2471 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2450 isolate,
2472 isolate, result,
2473 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); 2451 Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
2474 return *result;
2475 } 2452 }
2476 2453
2477 2454
2478 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { 2455 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
2479 HandleScope scope(isolate); 2456 HandleScope scope(isolate);
2480 DCHECK(args.length() == 5); 2457 DCHECK(args.length() == 5);
2481 Handle<Object> object = args.at<Object>(0); 2458 Handle<Object> object = args.at<Object>(0);
2482 Handle<Object> key = args.at<Object>(1); 2459 Handle<Object> key = args.at<Object>(1);
2483 Handle<Object> value = args.at<Object>(2); 2460 Handle<Object> value = args.at<Object>(2);
2484 LanguageMode language_mode; 2461 LanguageMode language_mode;
2485 KeyedStoreICNexus nexus(isolate); 2462 KeyedStoreICNexus nexus(isolate);
2486 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2463 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2487 language_mode = ic.language_mode(); 2464 language_mode = ic.language_mode();
2488 Handle<Object> result; 2465 RETURN_RESULT_OR_FAILURE(
2489 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2466 isolate,
2490 isolate, result,
2491 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); 2467 Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
2492 return *result;
2493 } 2468 }
2494 2469
2495 2470
2496 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) { 2471 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
2497 TimerEventScope<TimerEventIcMiss> timer(isolate); 2472 TimerEventScope<TimerEventIcMiss> timer(isolate);
2498 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2473 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2499 HandleScope scope(isolate); 2474 HandleScope scope(isolate);
2500 // Length == 5 or 6, depending on whether the vector slot 2475 // Length == 5 or 6, depending on whether the vector slot
2501 // is passed in a virtual register or not. 2476 // is passed in a virtual register or not.
2502 DCHECK(args.length() == 5 || args.length() == 6); 2477 DCHECK(args.length() == 5 || args.length() == 6);
2503 Handle<Object> object = args.at<Object>(0); 2478 Handle<Object> object = args.at<Object>(0);
2504 Handle<Object> key = args.at<Object>(1); 2479 Handle<Object> key = args.at<Object>(1);
2505 Handle<Object> value = args.at<Object>(2); 2480 Handle<Object> value = args.at<Object>(2);
2506 Handle<Map> map = args.at<Map>(3); 2481 Handle<Map> map = args.at<Map>(3);
2507 LanguageMode language_mode; 2482 LanguageMode language_mode;
2508 KeyedStoreICNexus nexus(isolate); 2483 KeyedStoreICNexus nexus(isolate);
2509 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2484 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2510 language_mode = ic.language_mode(); 2485 language_mode = ic.language_mode();
2511 if (object->IsJSObject()) { 2486 if (object->IsJSObject()) {
2512 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), 2487 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object),
2513 map->elements_kind()); 2488 map->elements_kind());
2514 } 2489 }
2515 Handle<Object> result; 2490 RETURN_RESULT_OR_FAILURE(
2516 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2491 isolate,
2517 isolate, result,
2518 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); 2492 Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
2519 return *result;
2520 } 2493 }
2521 2494
2522 2495
2523 MaybeHandle<Object> BinaryOpIC::Transition( 2496 MaybeHandle<Object> BinaryOpIC::Transition(
2524 Handle<AllocationSite> allocation_site, Handle<Object> left, 2497 Handle<AllocationSite> allocation_site, Handle<Object> left,
2525 Handle<Object> right) { 2498 Handle<Object> right) {
2526 BinaryOpICState state(isolate(), extra_ic_state()); 2499 BinaryOpICState state(isolate(), extra_ic_state());
2527 2500
2528 // Compute the actual result using the builtin for the binary operation. 2501 // Compute the actual result using the builtin for the binary operation.
2529 Handle<Object> result; 2502 Handle<Object> result;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 2611
2639 2612
2640 RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) { 2613 RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
2641 TimerEventScope<TimerEventIcMiss> timer(isolate); 2614 TimerEventScope<TimerEventIcMiss> timer(isolate);
2642 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2615 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2643 HandleScope scope(isolate); 2616 HandleScope scope(isolate);
2644 DCHECK_EQ(2, args.length()); 2617 DCHECK_EQ(2, args.length());
2645 Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft); 2618 Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft);
2646 Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight); 2619 Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight);
2647 BinaryOpIC ic(isolate); 2620 BinaryOpIC ic(isolate);
2648 Handle<Object> result; 2621 RETURN_RESULT_OR_FAILURE(
2649 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2622 isolate, ic.Transition(Handle<AllocationSite>::null(), left, right));
2650 isolate, result,
2651 ic.Transition(Handle<AllocationSite>::null(), left, right));
2652 return *result;
2653 } 2623 }
2654 2624
2655 2625
2656 RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) { 2626 RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) {
2657 TimerEventScope<TimerEventIcMiss> timer(isolate); 2627 TimerEventScope<TimerEventIcMiss> timer(isolate);
2658 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2628 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2659 HandleScope scope(isolate); 2629 HandleScope scope(isolate);
2660 DCHECK_EQ(3, args.length()); 2630 DCHECK_EQ(3, args.length());
2661 Handle<AllocationSite> allocation_site = 2631 Handle<AllocationSite> allocation_site =
2662 args.at<AllocationSite>(BinaryOpWithAllocationSiteStub::kAllocationSite); 2632 args.at<AllocationSite>(BinaryOpWithAllocationSiteStub::kAllocationSite);
2663 Handle<Object> left = args.at<Object>(BinaryOpWithAllocationSiteStub::kLeft); 2633 Handle<Object> left = args.at<Object>(BinaryOpWithAllocationSiteStub::kLeft);
2664 Handle<Object> right = 2634 Handle<Object> right =
2665 args.at<Object>(BinaryOpWithAllocationSiteStub::kRight); 2635 args.at<Object>(BinaryOpWithAllocationSiteStub::kRight);
2666 BinaryOpIC ic(isolate); 2636 BinaryOpIC ic(isolate);
2667 Handle<Object> result; 2637 RETURN_RESULT_OR_FAILURE(isolate,
2668 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2638 ic.Transition(allocation_site, left, right));
2669 isolate, result, ic.Transition(allocation_site, left, right));
2670 return *result;
2671 } 2639 }
2672 2640
2673 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) { 2641 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) {
2674 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, 2642 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED,
2675 CompareICState::UNINITIALIZED, 2643 CompareICState::UNINITIALIZED,
2676 CompareICState::UNINITIALIZED); 2644 CompareICState::UNINITIALIZED);
2677 Code* code = NULL; 2645 Code* code = NULL;
2678 CHECK(stub.FindCodeInCache(&code)); 2646 CHECK(stub.FindCodeInCache(&code));
2679 return code; 2647 return code;
2680 } 2648 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 return *result; 2926 return *result;
2959 } 2927 }
2960 2928
2961 2929
2962 RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) { 2930 RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
2963 TimerEventScope<TimerEventIcMiss> timer(isolate); 2931 TimerEventScope<TimerEventIcMiss> timer(isolate);
2964 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2932 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2965 HandleScope scope(isolate); 2933 HandleScope scope(isolate);
2966 Handle<Object> receiver = args.at<Object>(0); 2934 Handle<Object> receiver = args.at<Object>(0);
2967 Handle<Name> key = args.at<Name>(1); 2935 Handle<Name> key = args.at<Name>(1);
2968 Handle<Object> result;
2969 2936
2970 DCHECK(args.length() == 4); 2937 DCHECK(args.length() == 4);
2971 Handle<Smi> slot = args.at<Smi>(2); 2938 Handle<Smi> slot = args.at<Smi>(2);
2972 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2939 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2973 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2940 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2974 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the 2941 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the
2975 // LoadIC miss handler if the handler misses. Since the vector Nexus is 2942 // LoadIC miss handler if the handler misses. Since the vector Nexus is
2976 // set up outside the IC, handle that here. 2943 // set up outside the IC, handle that here.
2977 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) { 2944 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) {
2978 LoadICNexus nexus(vector, vector_slot); 2945 LoadICNexus nexus(vector, vector_slot);
2979 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2946 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2980 ic.UpdateState(receiver, key); 2947 ic.UpdateState(receiver, key);
2981 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2948 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2982 } else { 2949 } else {
2983 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2950 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2984 vector->GetKind(vector_slot)); 2951 vector->GetKind(vector_slot));
2985 KeyedLoadICNexus nexus(vector, vector_slot); 2952 KeyedLoadICNexus nexus(vector, vector_slot);
2986 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2953 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2987 ic.UpdateState(receiver, key); 2954 ic.UpdateState(receiver, key);
2988 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2955 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2989 } 2956 }
2990
2991 return *result;
2992 } 2957 }
2993 } // namespace internal 2958 } // namespace internal
2994 } // namespace v8 2959 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698