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

Side by Side Diff: src/accessors.cc

Issue 935603002: Stop using HeapType in IC and Crankshaft (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/accessors.h ('k') | src/hydrogen.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (Name::Equals(name, property_name)) { 62 if (Name::Equals(name, property_name)) {
63 *object_offset = offset; 63 *object_offset = offset;
64 return true; 64 return true;
65 } 65 }
66 return false; 66 return false;
67 } 67 }
68 68
69 69
70 // Returns true for properties that are accessors to object fields. 70 // Returns true for properties that are accessors to object fields.
71 // If true, *object_offset contains offset of object field. 71 // If true, *object_offset contains offset of object field.
72 template <class T> 72 bool Accessors::IsJSObjectFieldAccessor(Handle<Map> map, Handle<Name> name,
73 bool Accessors::IsJSObjectFieldAccessor(typename T::TypeHandle type,
74 Handle<Name> name,
75 int* object_offset) { 73 int* object_offset) {
76 Isolate* isolate = name->GetIsolate(); 74 Isolate* isolate = name->GetIsolate();
77 75
78 if (type->Is(T::String())) {
79 return CheckForName(name, isolate->factory()->length_string(),
80 String::kLengthOffset, object_offset);
81 }
82
83 if (!type->IsClass()) return false;
84 Handle<Map> map = type->AsClass()->Map();
85
86 switch (map->instance_type()) { 76 switch (map->instance_type()) {
87 case JS_ARRAY_TYPE: 77 case JS_ARRAY_TYPE:
88 return 78 return
89 CheckForName(name, isolate->factory()->length_string(), 79 CheckForName(name, isolate->factory()->length_string(),
90 JSArray::kLengthOffset, object_offset); 80 JSArray::kLengthOffset, object_offset);
91 case JS_TYPED_ARRAY_TYPE: 81 case JS_TYPED_ARRAY_TYPE:
92 return 82 return
93 CheckForName(name, isolate->factory()->length_string(), 83 CheckForName(name, isolate->factory()->length_string(),
94 JSTypedArray::kLengthOffset, object_offset) || 84 JSTypedArray::kLengthOffset, object_offset) ||
95 CheckForName(name, isolate->factory()->byte_length_string(), 85 CheckForName(name, isolate->factory()->byte_length_string(),
96 JSTypedArray::kByteLengthOffset, object_offset) || 86 JSTypedArray::kByteLengthOffset, object_offset) ||
97 CheckForName(name, isolate->factory()->byte_offset_string(), 87 CheckForName(name, isolate->factory()->byte_offset_string(),
98 JSTypedArray::kByteOffsetOffset, object_offset); 88 JSTypedArray::kByteOffsetOffset, object_offset);
99 case JS_ARRAY_BUFFER_TYPE: 89 case JS_ARRAY_BUFFER_TYPE:
100 return 90 return
101 CheckForName(name, isolate->factory()->byte_length_string(), 91 CheckForName(name, isolate->factory()->byte_length_string(),
102 JSArrayBuffer::kByteLengthOffset, object_offset); 92 JSArrayBuffer::kByteLengthOffset, object_offset);
103 case JS_DATA_VIEW_TYPE: 93 case JS_DATA_VIEW_TYPE:
104 return 94 return
105 CheckForName(name, isolate->factory()->byte_length_string(), 95 CheckForName(name, isolate->factory()->byte_length_string(),
106 JSDataView::kByteLengthOffset, object_offset) || 96 JSDataView::kByteLengthOffset, object_offset) ||
107 CheckForName(name, isolate->factory()->byte_offset_string(), 97 CheckForName(name, isolate->factory()->byte_offset_string(),
108 JSDataView::kByteOffsetOffset, object_offset); 98 JSDataView::kByteOffsetOffset, object_offset);
109 default: 99 default:
100 if (map->instance_type() < FIRST_NONSTRING_TYPE) {
101 return CheckForName(name, isolate->factory()->length_string(),
102 String::kLengthOffset, object_offset);
103 }
104
110 return false; 105 return false;
111 } 106 }
112 } 107 }
113 108
114 109
115 template
116 bool Accessors::IsJSObjectFieldAccessor<Type>(Type* type,
117 Handle<Name> name,
118 int* object_offset);
119
120
121 template
122 bool Accessors::IsJSObjectFieldAccessor<HeapType>(Handle<HeapType> type,
123 Handle<Name> name,
124 int* object_offset);
125
126
127 bool SetPropertyOnInstanceIfInherited( 110 bool SetPropertyOnInstanceIfInherited(
128 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info, 111 Isolate* isolate, const v8::PropertyCallbackInfo<void>& info,
129 v8::Local<v8::Name> name, Handle<Object> value) { 112 v8::Local<v8::Name> name, Handle<Object> value) {
130 Handle<Object> holder = Utils::OpenHandle(*info.Holder()); 113 Handle<Object> holder = Utils::OpenHandle(*info.Holder());
131 Handle<Object> receiver = Utils::OpenHandle(*info.This()); 114 Handle<Object> receiver = Utils::OpenHandle(*info.This());
132 if (*holder == *receiver) return false; 115 if (*holder == *receiver) return false;
133 if (receiver->IsJSObject()) { 116 if (receiver->IsJSObject()) {
134 Handle<JSObject> object = Handle<JSObject>::cast(receiver); 117 Handle<JSObject> object = Handle<JSObject>::cast(receiver);
135 // This behaves sloppy since we lost the actual strict-mode. 118 // This behaves sloppy since we lost the actual strict-mode.
136 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data 119 // TODO(verwaest): Fix by making ExecutableAccessorInfo behave like data
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 info->set_data(Smi::FromInt(index)); 1515 info->set_data(Smi::FromInt(index));
1533 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1516 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1534 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1517 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1535 info->set_getter(*getter); 1518 info->set_getter(*getter);
1536 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1519 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1537 return info; 1520 return info;
1538 } 1521 }
1539 1522
1540 1523
1541 } } // namespace v8::internal 1524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698