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/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 key->IsString() && String::cast(element)->Equals(String::cast(key))) { | 134 key->IsString() && String::cast(element)->Equals(String::cast(key))) { |
135 return true; | 135 return true; |
136 } | 136 } |
137 } | 137 } |
138 return false; | 138 return false; |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 MUST_USE_RESULT | 142 MUST_USE_RESULT |
143 static MaybeHandle<Object> ThrowArrayLengthRangeError(Isolate* isolate) { | 143 static MaybeHandle<Object> ThrowArrayLengthRangeError(Isolate* isolate) { |
144 return isolate->Throw<Object>( | 144 THROW_NEW_ERROR(isolate, NewRangeError("invalid_array_length", |
145 isolate->factory()->NewRangeError("invalid_array_length", | 145 HandleVector<Object>(NULL, 0)), |
146 HandleVector<Object>(NULL, 0))); | 146 Object); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 static void CopyObjectToObjectElements(FixedArrayBase* from_base, | 150 static void CopyObjectToObjectElements(FixedArrayBase* from_base, |
151 ElementsKind from_kind, | 151 ElementsKind from_kind, |
152 uint32_t from_start, | 152 uint32_t from_start, |
153 FixedArrayBase* to_base, | 153 FixedArrayBase* to_base, |
154 ElementsKind to_kind, uint32_t to_start, | 154 ElementsKind to_kind, uint32_t to_start, |
155 int raw_copy_size) { | 155 int raw_copy_size) { |
156 DCHECK(to_base->map() != | 156 DCHECK(to_base->map() != |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 Handle<SeededNumberDictionary>::cast(backing_store); | 1414 Handle<SeededNumberDictionary>::cast(backing_store); |
1415 int entry = dictionary->FindEntry(key); | 1415 int entry = dictionary->FindEntry(key); |
1416 if (entry != SeededNumberDictionary::kNotFound) { | 1416 if (entry != SeededNumberDictionary::kNotFound) { |
1417 Handle<Object> result = | 1417 Handle<Object> result = |
1418 SeededNumberDictionary::DeleteProperty(dictionary, entry, mode); | 1418 SeededNumberDictionary::DeleteProperty(dictionary, entry, mode); |
1419 if (*result == *isolate->factory()->false_value()) { | 1419 if (*result == *isolate->factory()->false_value()) { |
1420 if (mode == JSObject::STRICT_DELETION) { | 1420 if (mode == JSObject::STRICT_DELETION) { |
1421 // Deleting a non-configurable property in strict mode. | 1421 // Deleting a non-configurable property in strict mode. |
1422 Handle<Object> name = isolate->factory()->NewNumberFromUint(key); | 1422 Handle<Object> name = isolate->factory()->NewNumberFromUint(key); |
1423 Handle<Object> args[2] = { name, obj }; | 1423 Handle<Object> args[2] = { name, obj }; |
1424 Handle<Object> error = | 1424 THROW_NEW_ERROR(isolate, NewTypeError("strict_delete_property", |
1425 isolate->factory()->NewTypeError("strict_delete_property", | 1425 HandleVector(args, 2)), |
1426 HandleVector(args, 2)); | 1426 Object); |
1427 return isolate->Throw<Object>(error); | |
1428 } | 1427 } |
1429 return isolate->factory()->false_value(); | 1428 return isolate->factory()->false_value(); |
1430 } | 1429 } |
1431 Handle<FixedArray> new_elements = | 1430 Handle<FixedArray> new_elements = |
1432 SeededNumberDictionary::Shrink(dictionary, key); | 1431 SeededNumberDictionary::Shrink(dictionary, key); |
1433 | 1432 |
1434 if (is_arguments) { | 1433 if (is_arguments) { |
1435 FixedArray::cast(obj->elements())->set(1, *new_elements); | 1434 FixedArray::cast(obj->elements())->set(1, *new_elements); |
1436 } else { | 1435 } else { |
1437 obj->set_elements(*new_elements); | 1436 obj->set_elements(*new_elements); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 UNREACHABLE(); | 1897 UNREACHABLE(); |
1899 break; | 1898 break; |
1900 } | 1899 } |
1901 | 1900 |
1902 array->set_elements(*elms); | 1901 array->set_elements(*elms); |
1903 array->set_length(Smi::FromInt(number_of_elements)); | 1902 array->set_length(Smi::FromInt(number_of_elements)); |
1904 return array; | 1903 return array; |
1905 } | 1904 } |
1906 | 1905 |
1907 } } // namespace v8::internal | 1906 } } // namespace v8::internal |
OLD | NEW |