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

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: 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') | src/lookup.cc » ('J')
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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 1545
1547 // Check if the given name is an array index. 1546 // Check if the given name is an array index.
1548 uint32_t index; 1547 uint32_t index;
1549 if (name->AsArrayIndex(&index)) { 1548 if (name->AsArrayIndex(&index)) {
1550 // Ignore other stores where the receiver is not a JSObject. 1549 // Ignore other stores where the receiver is not a JSObject.
1551 // TODO(1475): Must check prototype chains of object wrappers. 1550 // TODO(1475): Must check prototype chains of object wrappers.
1552 if (!object->IsJSObject()) return value; 1551 if (!object->IsJSObject()) return value;
1553 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1552 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1554 1553
1555 Handle<Object> result; 1554 Handle<Object> result;
1556 ASSIGN_RETURN_ON_EXCEPTION( 1555 ASSIGN_RETURN_ON_EXCEPTION(isolate(), result,
1557 isolate(), result, 1556 JSObject::SetElement(isolate(), receiver, index,
1558 JSObject::SetElement(receiver, index, value, language_mode()), Object); 1557 value, language_mode()),
1558 Object);
1559 return value; 1559 return value;
1560 } 1560 }
1561 1561
1562 // Observed objects are always modified through the runtime. 1562 // Observed objects are always modified through the runtime.
1563 if (object->IsHeapObject() && 1563 if (object->IsHeapObject() &&
1564 Handle<HeapObject>::cast(object)->map()->is_observed()) { 1564 Handle<HeapObject>::cast(object)->map()->is_observed()) {
1565 Handle<Object> result; 1565 Handle<Object> result;
1566 ASSIGN_RETURN_ON_EXCEPTION( 1566 ASSIGN_RETURN_ON_EXCEPTION(
1567 isolate(), result, 1567 isolate(), result,
1568 Object::SetProperty(object, name, value, language_mode(), store_mode), 1568 Object::SetProperty(object, name, value, language_mode(), store_mode),
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 static const Address IC_utilities[] = { 3101 static const Address IC_utilities[] = {
3102 #define ADDR(name) FUNCTION_ADDR(name), 3102 #define ADDR(name) FUNCTION_ADDR(name),
3103 IC_UTIL_LIST(ADDR) NULL 3103 IC_UTIL_LIST(ADDR) NULL
3104 #undef ADDR 3104 #undef ADDR
3105 }; 3105 };
3106 3106
3107 3107
3108 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3108 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3109 } // namespace internal 3109 } // namespace internal
3110 } // namespace v8 3110 } // namespace v8
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/liveedit.h » ('j') | src/lookup.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698