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

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

Issue 1612323003: Introduce {FAST,SLOW}_STRING_WRAPPER_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more DCHECK fix Created 4 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/heap/heap.cc ('k') | src/ic/ic-compiler.cc » ('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/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 if (object->IsJSGlobalObject() && name->IsString()) { 679 if (object->IsJSGlobalObject() && name->IsString()) {
680 // Look up in script context table. 680 // Look up in script context table.
681 Handle<String> str_name = Handle<String>::cast(name); 681 Handle<String> str_name = Handle<String>::cast(name);
682 Handle<JSGlobalObject> global = Handle<JSGlobalObject>::cast(object); 682 Handle<JSGlobalObject> global = Handle<JSGlobalObject>::cast(object);
683 Handle<ScriptContextTable> script_contexts( 683 Handle<ScriptContextTable> script_contexts(
684 global->native_context()->script_context_table()); 684 global->native_context()->script_context_table());
685 685
686 ScriptContextTable::LookupResult lookup_result; 686 ScriptContextTable::LookupResult lookup_result;
687 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) { 687 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
688 Handle<Object> result = 688 Handle<Object> result =
689 FixedArray::get(ScriptContextTable::GetContext( 689 FixedArray::get(*ScriptContextTable::GetContext(
690 script_contexts, lookup_result.context_index), 690 script_contexts, lookup_result.context_index),
691 lookup_result.slot_index); 691 lookup_result.slot_index, isolate());
692 if (*result == *isolate()->factory()->the_hole_value()) { 692 if (*result == *isolate()->factory()->the_hole_value()) {
693 // Do not install stubs and stay pre-monomorphic for 693 // Do not install stubs and stay pre-monomorphic for
694 // uninitialized accesses. 694 // uninitialized accesses.
695 return ReferenceError(name); 695 return ReferenceError(name);
696 } 696 }
697 697
698 if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) { 698 if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) {
699 LoadScriptContextFieldStub stub(isolate(), &lookup_result); 699 LoadScriptContextFieldStub stub(isolate(), &lookup_result);
700 PatchCache(name, stub.GetCode()); 700 PatchCache(name, stub.GetCode());
701 } 701 }
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 Handle<Code> stub = megamorphic_stub(); 1368 Handle<Code> stub = megamorphic_stub();
1369 1369
1370 // Check for non-string values that can be converted into an 1370 // Check for non-string values that can be converted into an
1371 // internalized string directly or is representable as a smi. 1371 // internalized string directly or is representable as a smi.
1372 key = TryConvertKey(key, isolate()); 1372 key = TryConvertKey(key, isolate());
1373 1373
1374 if (key->IsInternalizedString() || key->IsSymbol()) { 1374 if (key->IsInternalizedString() || key->IsSymbol()) {
1375 ASSIGN_RETURN_ON_EXCEPTION(isolate(), load_handle, 1375 ASSIGN_RETURN_ON_EXCEPTION(isolate(), load_handle,
1376 LoadIC::Load(object, Handle<Name>::cast(key)), 1376 LoadIC::Load(object, Handle<Name>::cast(key)),
1377 Object); 1377 Object);
1378 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { 1378 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded() &&
1379 !object->IsJSValue()) {
1379 if (object->IsJSObject() || (object->IsString() && key->IsNumber())) { 1380 if (object->IsJSObject() || (object->IsString() && key->IsNumber())) {
1380 Handle<HeapObject> receiver = Handle<HeapObject>::cast(object); 1381 Handle<HeapObject> receiver = Handle<HeapObject>::cast(object);
1381 if (object->IsString() || key->IsSmi()) stub = LoadElementStub(receiver); 1382 if (object->IsString() || key->IsSmi()) stub = LoadElementStub(receiver);
1382 } 1383 }
1383 } 1384 }
1384 1385
1385 DCHECK(UseVector()); 1386 DCHECK(UseVector());
1386 if (!is_vector_set() || stub.is_null()) { 1387 if (!is_vector_set() || stub.is_null()) {
1387 Code* generic = *megamorphic_stub(); 1388 Code* generic = *megamorphic_stub();
1388 if (!stub.is_null() && *stub == generic) { 1389 if (!stub.is_null() && *stub == generic) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 1501
1501 ScriptContextTable::LookupResult lookup_result; 1502 ScriptContextTable::LookupResult lookup_result;
1502 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) { 1503 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
1503 Handle<Context> script_context = ScriptContextTable::GetContext( 1504 Handle<Context> script_context = ScriptContextTable::GetContext(
1504 script_contexts, lookup_result.context_index); 1505 script_contexts, lookup_result.context_index);
1505 if (lookup_result.mode == CONST) { 1506 if (lookup_result.mode == CONST) {
1506 return TypeError(MessageTemplate::kConstAssign, object, name); 1507 return TypeError(MessageTemplate::kConstAssign, object, name);
1507 } 1508 }
1508 1509
1509 Handle<Object> previous_value = 1510 Handle<Object> previous_value =
1510 FixedArray::get(script_context, lookup_result.slot_index); 1511 FixedArray::get(*script_context, lookup_result.slot_index, isolate());
1511 1512
1512 if (*previous_value == *isolate()->factory()->the_hole_value()) { 1513 if (*previous_value == *isolate()->factory()->the_hole_value()) {
1513 // Do not install stubs and stay pre-monomorphic for 1514 // Do not install stubs and stay pre-monomorphic for
1514 // uninitialized accesses. 1515 // uninitialized accesses.
1515 return ReferenceError(name); 1516 return ReferenceError(name);
1516 } 1517 }
1517 1518
1518 if (FLAG_use_ic && 1519 if (FLAG_use_ic &&
1519 StoreScriptContextFieldStub::Accepted(&lookup_result)) { 1520 StoreScriptContextFieldStub::Accepted(&lookup_result)) {
1520 StoreScriptContextFieldStub stub(isolate(), &lookup_result); 1521 StoreScriptContextFieldStub stub(isolate(), &lookup_result);
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 KeyedLoadICNexus nexus(vector, vector_slot); 2974 KeyedLoadICNexus nexus(vector, vector_slot);
2974 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2975 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2975 ic.UpdateState(receiver, key); 2976 ic.UpdateState(receiver, key);
2976 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2977 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
2977 } 2978 }
2978 2979
2979 return *result; 2980 return *result;
2980 } 2981 }
2981 } // namespace internal 2982 } // namespace internal
2982 } // namespace v8 2983 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/ic/ic-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698