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

Side by Side Diff: src/accessors.cc

Issue 1064083003: Recover performance of array buffer view field accesses in ICs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/accessors.h ('k') | src/code-stubs.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/contexts.h" 9 #include "src/contexts.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (map->instance_type() < FIRST_NONSTRING_TYPE) { 86 if (map->instance_type() < FIRST_NONSTRING_TYPE) {
87 return CheckForName(name, isolate->factory()->length_string(), 87 return CheckForName(name, isolate->factory()->length_string(),
88 String::kLengthOffset, object_offset); 88 String::kLengthOffset, object_offset);
89 } 89 }
90 90
91 return false; 91 return false;
92 } 92 }
93 } 93 }
94 94
95 95
96 bool Accessors::IsJSArrayBufferViewFieldAccessor(Handle<Map> map,
97 Handle<Name> name,
98 int* object_offset) {
99 Isolate* isolate = name->GetIsolate();
100
101 switch (map->instance_type()) {
102 case JS_TYPED_ARRAY_TYPE:
103 // %TypedArray%.prototype is non-configurable, and so are the following
104 // named properties on %TypedArray%.prototype, so we can directly inline
105 // the field-load for typed array maps that still use their
106 // %TypedArray%.prototype.
107 if (JSFunction::cast(map->GetConstructor())->prototype() !=
108 map->prototype()) {
109 return false;
110 }
111 return CheckForName(name, isolate->factory()->length_string(),
112 JSTypedArray::kLengthOffset, object_offset) ||
113 CheckForName(name, isolate->factory()->byte_length_string(),
114 JSTypedArray::kByteLengthOffset, object_offset) ||
115 CheckForName(name, isolate->factory()->byte_offset_string(),
116 JSTypedArray::kByteOffsetOffset, object_offset);
117
118 case JS_DATA_VIEW_TYPE:
119 return CheckForName(name, isolate->factory()->byte_length_string(),
120 JSDataView::kByteLengthOffset, object_offset) ||
121 CheckForName(name, isolate->factory()->byte_offset_string(),
122 JSDataView::kByteOffsetOffset, object_offset);
123 default:
124 return false;
125 }
126 }
127
128
96 bool SetPropertyOnInstanceIfInherited( 129 bool SetPropertyOnInstanceIfInherited(
97 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info, 130 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info,
98 v8::Local<v8::Name> name, Handle<Object> value) { 131 v8::Local<v8::Name> name, Handle<Object> value) {
99 Handle<Object> holder = Utils::OpenHandle(*info.Holder()); 132 Handle<Object> holder = Utils::OpenHandle(*info.Holder());
100 Handle<Object> receiver = Utils::OpenHandle(*info.This()); 133 Handle<Object> receiver = Utils::OpenHandle(*info.This());
101 if (*holder == *receiver) return false; 134 if (*holder == *receiver) return false;
102 if (receiver->IsJSObject()) { 135 if (receiver->IsJSObject()) {
103 Handle<JSObject> object = Handle<JSObject>::cast(receiver); 136 Handle<JSObject> object = Handle<JSObject>::cast(receiver);
104 // This behaves sloppy since we lost the actual strict-mode. 137 // This behaves sloppy since we lost the actual strict-mode.
105 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data 138 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 info->set_data(Smi::FromInt(index)); 1487 info->set_data(Smi::FromInt(index));
1455 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1488 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1456 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1489 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1457 info->set_getter(*getter); 1490 info->set_getter(*getter);
1458 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1491 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1459 return info; 1492 return info;
1460 } 1493 }
1461 1494
1462 1495
1463 } } // namespace v8::internal 1496 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698