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 "v8.h" | 5 #include "v8.h" |
6 #include "accessors.h" | 6 #include "accessors.h" |
7 | 7 |
8 #include "compiler.h" | 8 #include "compiler.h" |
9 #include "contexts.h" | 9 #include "contexts.h" |
10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 176 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
177 HandleScope scope(isolate); | 177 HandleScope scope(isolate); |
178 Handle<JSObject> object = Handle<JSObject>::cast( | 178 Handle<JSObject> object = Handle<JSObject>::cast( |
179 Utils::OpenHandle(*info.This())); | 179 Utils::OpenHandle(*info.This())); |
180 Handle<Object> value = Utils::OpenHandle(*val); | 180 Handle<Object> value = Utils::OpenHandle(*val); |
181 // This means one of the object's prototypes is a JSArray and the | 181 // This means one of the object's prototypes is a JSArray and the |
182 // object does not have a 'length' property. Calling SetProperty | 182 // object does not have a 'length' property. Calling SetProperty |
183 // causes an infinite loop. | 183 // causes an infinite loop. |
184 if (!object->IsJSArray()) { | 184 if (!object->IsJSArray()) { |
185 MaybeHandle<Object> maybe_result = | 185 MaybeHandle<Object> maybe_result = |
186 JSObject::SetLocalPropertyIgnoreAttributes( | 186 JSObject::SetOwnPropertyIgnoreAttributes( |
187 object, isolate->factory()->length_string(), value, NONE); | 187 object, isolate->factory()->length_string(), value, NONE); |
188 maybe_result.Check(); | 188 maybe_result.Check(); |
189 return; | 189 return; |
190 } | 190 } |
191 | 191 |
192 value = FlattenNumber(isolate, value); | 192 value = FlattenNumber(isolate, value); |
193 | 193 |
194 Handle<JSArray> array_handle = Handle<JSArray>::cast(object); | 194 Handle<JSArray> array_handle = Handle<JSArray>::cast(object); |
195 MaybeHandle<Object> maybe; | 195 MaybeHandle<Object> maybe; |
196 Handle<Object> uint32_v; | 196 Handle<Object> uint32_v; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 { | 783 { |
784 DisallowHeapAllocation no_allocation; | 784 DisallowHeapAllocation no_allocation; |
785 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver); | 785 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver); |
786 if (function_raw == NULL) return isolate->factory()->undefined_value(); | 786 if (function_raw == NULL) return isolate->factory()->undefined_value(); |
787 function = Handle<JSFunction>(function_raw, isolate); | 787 function = Handle<JSFunction>(function_raw, isolate); |
788 } | 788 } |
789 | 789 |
790 if (!function->should_have_prototype()) { | 790 if (!function->should_have_prototype()) { |
791 // Since we hit this accessor, object will have no prototype property. | 791 // Since we hit this accessor, object will have no prototype property. |
792 MaybeHandle<Object> maybe_result = | 792 MaybeHandle<Object> maybe_result = |
793 JSObject::SetLocalPropertyIgnoreAttributes( | 793 JSObject::SetOwnPropertyIgnoreAttributes( |
794 receiver, isolate->factory()->prototype_string(), value, NONE); | 794 receiver, isolate->factory()->prototype_string(), value, NONE); |
795 return maybe_result.ToHandleChecked(); | 795 return maybe_result.ToHandleChecked(); |
796 } | 796 } |
797 | 797 |
798 Handle<Object> old_value; | 798 Handle<Object> old_value; |
799 bool is_observed = *function == *receiver && function->map()->is_observed(); | 799 bool is_observed = *function == *receiver && function->map()->is_observed(); |
800 if (is_observed) { | 800 if (is_observed) { |
801 if (function->has_prototype()) | 801 if (function->has_prototype()) |
802 old_value = handle(function->prototype(), isolate); | 802 old_value = handle(function->prototype(), isolate); |
803 else | 803 else |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 info->set_data(Smi::FromInt(index)); | 1338 info->set_data(Smi::FromInt(index)); |
1339 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1339 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1340 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1340 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1341 info->set_getter(*getter); | 1341 info->set_getter(*getter); |
1342 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1342 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1343 return info; | 1343 return info; |
1344 } | 1344 } |
1345 | 1345 |
1346 | 1346 |
1347 } } // namespace v8::internal | 1347 } } // namespace v8::internal |
OLD | NEW |