OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 11330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11341 } | 11341 } |
11342 | 11342 |
11343 if (IsJSArray()) { | 11343 if (IsJSArray()) { |
11344 JSArray::cast(this)->set_length(Smi::FromInt(length)); | 11344 JSArray::cast(this)->set_length(Smi::FromInt(length)); |
11345 } | 11345 } |
11346 | 11346 |
11347 return this; | 11347 return this; |
11348 } | 11348 } |
11349 | 11349 |
11350 | 11350 |
11351 // TODO(ishell): temporary wrapper until handlified. | |
11352 // static | |
11353 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { | |
Yang
2014/03/18 09:52:17
Why is this still a "temporary wrapper"? Afaict th
Igor Sheludko
2014/03/18 11:25:10
Actually I did this in a next CL, but you are righ
| |
11354 ASSERT(capacity >= 0); | |
11355 array->GetIsolate()->factory()->NewJSArrayStorage( | |
11356 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | |
11357 } | |
11358 | |
11359 | |
11351 MaybeObject* JSArray::Initialize(int capacity, int length) { | 11360 MaybeObject* JSArray::Initialize(int capacity, int length) { |
11352 ASSERT(capacity >= 0); | 11361 ASSERT(capacity >= 0); |
11353 return GetHeap()->AllocateJSArrayStorage(this, length, capacity, | 11362 return GetHeap()->AllocateJSArrayStorage(this, length, capacity, |
11354 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 11363 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
11355 } | 11364 } |
11356 | 11365 |
11357 | 11366 |
11358 void JSArray::Expand(int required_size) { | 11367 void JSArray::Expand(int required_size) { |
11359 GetIsolate()->factory()->SetElementsCapacityAndLength( | 11368 GetIsolate()->factory()->SetElementsCapacityAndLength( |
11360 Handle<JSArray>(this), required_size, required_size); | 11369 Handle<JSArray>(this), required_size, required_size); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11423 | 11432 |
11424 bool threw; | 11433 bool threw; |
11425 Execution::Call(isolate, | 11434 Execution::Call(isolate, |
11426 Handle<JSFunction>(isolate->observers_end_perform_splice()), | 11435 Handle<JSFunction>(isolate->observers_end_perform_splice()), |
11427 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, | 11436 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, |
11428 &threw); | 11437 &threw); |
11429 ASSERT(!threw); | 11438 ASSERT(!threw); |
11430 } | 11439 } |
11431 | 11440 |
11432 | 11441 |
11442 // TODO(ishell): Temporary wrapper until handlified. | |
11443 // static | |
11444 Handle<Object> JSArray::SetElementsLength(Handle<JSArray> array, | |
11445 Handle<Object> length) { | |
11446 CALL_HEAP_FUNCTION(array->GetIsolate(), | |
11447 array->SetElementsLength(*length), | |
11448 Object); | |
11449 } | |
11450 | |
11451 | |
11433 MaybeObject* JSArray::SetElementsLength(Object* len) { | 11452 MaybeObject* JSArray::SetElementsLength(Object* len) { |
11434 // We should never end in here with a pixel or external array. | 11453 // We should never end in here with a pixel or external array. |
11435 ASSERT(AllowsSetElementsLength()); | 11454 ASSERT(AllowsSetElementsLength()); |
11436 if (!map()->is_observed()) | 11455 if (!map()->is_observed()) |
11437 return GetElementsAccessor()->SetLength(this, len); | 11456 return GetElementsAccessor()->SetLength(this, len); |
11438 | 11457 |
11439 Isolate* isolate = GetIsolate(); | 11458 Isolate* isolate = GetIsolate(); |
11440 HandleScope scope(isolate); | 11459 HandleScope scope(isolate); |
11441 Handle<JSArray> self(this); | 11460 Handle<JSArray> self(this); |
11442 List<uint32_t> indices; | 11461 List<uint32_t> indices; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11886 // map go generic. | 11905 // map go generic. |
11887 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); | 11906 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); |
11888 } | 11907 } |
11889 | 11908 |
11890 heap->ClearInstanceofCache(); | 11909 heap->ClearInstanceofCache(); |
11891 ASSERT(size == object->Size()); | 11910 ASSERT(size == object->Size()); |
11892 return value; | 11911 return value; |
11893 } | 11912 } |
11894 | 11913 |
11895 | 11914 |
11915 // TODO(ishell): temporary wrapper until handilfied. | |
11916 // static | |
11917 void JSObject::EnsureCanContainElements(Handle<JSObject> object, | |
11918 Arguments* args, | |
11919 uint32_t first_arg, | |
11920 uint32_t arg_count, | |
11921 EnsureElementsMode mode) { | |
11922 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | |
11923 object->EnsureCanContainElements(args, | |
11924 first_arg, | |
11925 arg_count, | |
11926 mode)); | |
11927 } | |
11928 | |
11929 | |
11896 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args, | 11930 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args, |
11897 uint32_t first_arg, | 11931 uint32_t first_arg, |
11898 uint32_t arg_count, | 11932 uint32_t arg_count, |
11899 EnsureElementsMode mode) { | 11933 EnsureElementsMode mode) { |
11900 // Elements in |Arguments| are ordered backwards (because they're on the | 11934 // Elements in |Arguments| are ordered backwards (because they're on the |
11901 // stack), but the method that's called here iterates over them in forward | 11935 // stack), but the method that's called here iterates over them in forward |
11902 // direction. | 11936 // direction. |
11903 return EnsureCanContainElements( | 11937 return EnsureCanContainElements( |
11904 args->arguments() - first_arg - (arg_count - 1), | 11938 args->arguments() - first_arg - (arg_count - 1), |
11905 arg_count, mode); | 11939 arg_count, mode); |
(...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16492 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16526 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16493 static const char* error_messages_[] = { | 16527 static const char* error_messages_[] = { |
16494 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16528 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16495 }; | 16529 }; |
16496 #undef ERROR_MESSAGES_TEXTS | 16530 #undef ERROR_MESSAGES_TEXTS |
16497 return error_messages_[reason]; | 16531 return error_messages_[reason]; |
16498 } | 16532 } |
16499 | 16533 |
16500 | 16534 |
16501 } } // namespace v8::internal | 16535 } } // namespace v8::internal |
OLD | NEW |