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

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

Issue 1221303019: Fix keyed access of primitive objects in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 5 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/execution.cc ('k') | src/liveedit.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/v8.h" 5 #include "src/v8.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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // Rewrite to the generic keyed load stub. 690 // Rewrite to the generic keyed load stub.
691 if (FLAG_use_ic) { 691 if (FLAG_use_ic) {
692 DCHECK(UseVector()); 692 DCHECK(UseVector());
693 ConfigureVectorState(MEGAMORPHIC); 693 ConfigureVectorState(MEGAMORPHIC);
694 TRACE_IC("LoadIC", name); 694 TRACE_IC("LoadIC", name);
695 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index"); 695 TRACE_GENERIC_IC(isolate(), "LoadIC", "name as array index");
696 } 696 }
697 Handle<Object> result; 697 Handle<Object> result;
698 ASSIGN_RETURN_ON_EXCEPTION( 698 ASSIGN_RETURN_ON_EXCEPTION(
699 isolate(), result, 699 isolate(), result,
700 Runtime::GetElementOrCharAt(isolate(), object, index, language_mode()), 700 Object::GetElement(isolate(), object, index, language_mode()), Object);
701 Object);
702 return result; 701 return result;
703 } 702 }
704 703
705 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; 704 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;
706 705
707 if (object->IsGlobalObject() && name->IsString()) { 706 if (object->IsGlobalObject() && name->IsString()) {
708 // Look up in script context table. 707 // Look up in script context table.
709 Handle<String> str_name = Handle<String>::cast(name); 708 Handle<String> str_name = Handle<String>::cast(name);
710 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); 709 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
711 Handle<ScriptContextTable> script_contexts( 710 Handle<ScriptContextTable> script_contexts(
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 uint32_t index; 1549 uint32_t index;
1551 if (name->AsArrayIndex(&index)) { 1550 if (name->AsArrayIndex(&index)) {
1552 // Ignore other stores where the receiver is not a JSObject. 1551 // Ignore other stores where the receiver is not a JSObject.
1553 // TODO(1475): Must check prototype chains of object wrappers. 1552 // TODO(1475): Must check prototype chains of object wrappers.
1554 if (!object->IsJSObject()) return value; 1553 if (!object->IsJSObject()) return value;
1555 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1554 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1556 1555
1557 Handle<Object> result; 1556 Handle<Object> result;
1558 ASSIGN_RETURN_ON_EXCEPTION( 1557 ASSIGN_RETURN_ON_EXCEPTION(
1559 isolate(), result, 1558 isolate(), result,
1560 JSObject::SetElement(receiver, index, value, language_mode()), Object); 1559 Object::SetElement(isolate(), receiver, index, value, language_mode()),
1560 Object);
1561 return value; 1561 return value;
1562 } 1562 }
1563 1563
1564 // Observed objects are always modified through the runtime. 1564 // Observed objects are always modified through the runtime.
1565 if (object->IsHeapObject() && 1565 if (object->IsHeapObject() &&
1566 Handle<HeapObject>::cast(object)->map()->is_observed()) { 1566 Handle<HeapObject>::cast(object)->map()->is_observed()) {
1567 Handle<Object> result; 1567 Handle<Object> result;
1568 ASSIGN_RETURN_ON_EXCEPTION( 1568 ASSIGN_RETURN_ON_EXCEPTION(
1569 isolate(), result, 1569 isolate(), result,
1570 Object::SetProperty(object, name, value, language_mode(), store_mode), 1570 Object::SetProperty(object, name, value, language_mode(), store_mode),
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3105 static const Address IC_utilities[] = { 3105 static const Address IC_utilities[] = {
3106 #define ADDR(name) FUNCTION_ADDR(name), 3106 #define ADDR(name) FUNCTION_ADDR(name),
3107 IC_UTIL_LIST(ADDR) NULL 3107 IC_UTIL_LIST(ADDR) NULL
3108 #undef ADDR 3108 #undef ADDR
3109 }; 3109 };
3110 3110
3111 3111
3112 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3112 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3113 } // namespace internal 3113 } // namespace internal
3114 } // namespace v8 3114 } // namespace v8
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698