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

Side by Side Diff: src/accessors.cc

Issue 24360019: Speed up ArrayBuffer/typed array/DataView properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: After self-review Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/accessors.h ('k') | src/heap.h » ('j') | src/ic.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 MaybeObject* Accessors::ReadOnlySetAccessor(Isolate* isolate, 71 MaybeObject* Accessors::ReadOnlySetAccessor(Isolate* isolate,
72 JSObject*, 72 JSObject*,
73 Object* value, 73 Object* value,
74 void*) { 74 void*) {
75 // According to ECMA-262, section 8.6.2.2, page 28, setting 75 // According to ECMA-262, section 8.6.2.2, page 28, setting
76 // read-only properties must be silently ignored. 76 // read-only properties must be silently ignored.
77 return value; 77 return value;
78 } 78 }
79 79
80 80
81 static V8_INLINE bool CheckForName(Handle<String> name,
82 String* property_name,
83 int offset,
84 int* object_offset) {
85 if (name->Equals(property_name)) {
86 *object_offset = offset;
87 return true;
88 }
89 return false;
90 }
91
92
93 bool Accessors::IsJSObjectFieldAccessor(
94 Handle<Map> map, Handle<String> name,
95 int* object_offset) {
96 Isolate* isolate = map->GetIsolate();
97 switch (map->instance_type()) {
98 case JS_ARRAY_TYPE:
99 return
100 CheckForName(name, isolate->heap()->length_string(),
101 JSArray::kLengthOffset, object_offset);
102 case JS_TYPED_ARRAY_TYPE:
103 return
104 CheckForName(name, isolate->heap()->length_string(),
105 JSTypedArray::kLengthOffset, object_offset) ||
106 CheckForName(name, isolate->heap()->byte_length_string(),
107 JSTypedArray::kByteLengthOffset, object_offset) ||
108 CheckForName(name, isolate->heap()->byte_offset_string(),
109 JSTypedArray::kByteOffsetOffset, object_offset) ||
110 CheckForName(name, isolate->heap()->buffer_string(),
111 JSTypedArray::kBufferOffset, object_offset);
112 case JS_ARRAY_BUFFER_TYPE:
113 return
114 CheckForName(name, isolate->heap()->byte_length_string(),
115 JSArrayBuffer::kByteLengthOffset, object_offset);
116 case JS_DATA_VIEW_TYPE:
117 return
118 CheckForName(name, isolate->heap()->byte_length_string(),
119 JSDataView::kByteLengthOffset, object_offset) ||
120 CheckForName(name, isolate->heap()->byte_offset_string(),
121 JSDataView::kByteOffsetOffset, object_offset) ||
122 CheckForName(name, isolate->heap()->buffer_string(),
123 JSDataView::kBufferOffset, object_offset);
124 default: {
125 if (map->instance_type() < FIRST_NONSTRING_TYPE) {
126 return
127 CheckForName(name, isolate->heap()->length_string(),
128 String::kLengthOffset, object_offset);
129 }
130 return false;
131 }
132 }
133 }
134
135
81 // 136 //
82 // Accessors::ArrayLength 137 // Accessors::ArrayLength
83 // 138 //
84 139
85 140
86 MaybeObject* Accessors::ArrayGetLength(Isolate* isolate, 141 MaybeObject* Accessors::ArrayGetLength(Isolate* isolate,
87 Object* object, 142 Object* object,
88 void*) { 143 void*) {
89 // Traverse the prototype chain until we reach an array. 144 // Traverse the prototype chain until we reach an array.
90 JSArray* holder = FindInstanceOf<JSArray>(isolate, object); 145 JSArray* holder = FindInstanceOf<JSArray>(isolate, object);
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 info->set_data(Smi::FromInt(index)); 962 info->set_data(Smi::FromInt(index));
908 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 963 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
909 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 964 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
910 info->set_getter(*getter); 965 info->set_getter(*getter);
911 if (!(attributes & ReadOnly)) info->set_setter(*setter); 966 if (!(attributes & ReadOnly)) info->set_setter(*setter);
912 return info; 967 return info;
913 } 968 }
914 969
915 970
916 } } // namespace v8::internal 971 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/heap.h » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698