OLD | NEW |
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/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // | 146 // |
147 // Accessors::ArrayLength | 147 // Accessors::ArrayLength |
148 // | 148 // |
149 | 149 |
150 | 150 |
151 // The helper function will 'flatten' Number objects. | 151 // The helper function will 'flatten' Number objects. |
152 Handle<Object> Accessors::FlattenNumber(Isolate* isolate, | 152 Handle<Object> Accessors::FlattenNumber(Isolate* isolate, |
153 Handle<Object> value) { | 153 Handle<Object> value) { |
154 if (value->IsNumber() || !value->IsJSValue()) return value; | 154 if (value->IsNumber() || !value->IsJSValue()) return value; |
155 Handle<JSValue> wrapper = Handle<JSValue>::cast(value); | 155 Handle<JSValue> wrapper = Handle<JSValue>::cast(value); |
156 ASSERT(wrapper->GetIsolate()->context()->native_context()->number_function()-> | 156 ASSERT(wrapper->GetIsolate()->native_context()->number_function()-> |
157 has_initial_map()); | 157 has_initial_map()); |
158 if (wrapper->map() == | 158 if (wrapper->map() == isolate->number_function()->initial_map()) { |
159 isolate->context()->native_context()->number_function()->initial_map()) { | |
160 return handle(wrapper->value(), isolate); | 159 return handle(wrapper->value(), isolate); |
161 } | 160 } |
162 | 161 |
163 return value; | 162 return value; |
164 } | 163 } |
165 | 164 |
166 | 165 |
167 void Accessors::ArrayLengthGetter( | 166 void Accessors::ArrayLengthGetter( |
168 v8::Local<v8::String> name, | 167 v8::Local<v8::String> name, |
169 const v8::PropertyCallbackInfo<v8::Value>& info) { | 168 const v8::PropertyCallbackInfo<v8::Value>& info) { |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 info->set_data(Smi::FromInt(index)); | 1351 info->set_data(Smi::FromInt(index)); |
1353 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1352 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1354 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1353 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1355 info->set_getter(*getter); | 1354 info->set_getter(*getter); |
1356 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1355 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1357 return info; | 1356 return info; |
1358 } | 1357 } |
1359 | 1358 |
1360 | 1359 |
1361 } } // namespace v8::internal | 1360 } } // namespace v8::internal |
OLD | NEW |