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

Side by Side Diff: src/objects.cc

Issue 201303009: Handlification of ArrayConstructorCommon(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-heap.cc » ('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 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
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 MaybeObject* JSArray::Initialize(int capacity, int length) { 11351 // static
11352 void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
11352 ASSERT(capacity >= 0); 11353 ASSERT(capacity >= 0);
11353 return GetHeap()->AllocateJSArrayStorage(this, length, capacity, 11354 array->GetIsolate()->factory()->NewJSArrayStorage(
11354 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); 11355 array, length, capacity, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
11355 } 11356 }
11356 11357
11357 11358
11358 void JSArray::Expand(int required_size) { 11359 void JSArray::Expand(int required_size) {
11359 GetIsolate()->factory()->SetElementsCapacityAndLength( 11360 GetIsolate()->factory()->SetElementsCapacityAndLength(
11360 Handle<JSArray>(this), required_size, required_size); 11361 Handle<JSArray>(this), required_size, required_size);
11361 } 11362 }
11362 11363
11363 11364
11364 // Returns false if the passed-in index is marked non-configurable, 11365 // Returns false if the passed-in index is marked non-configurable,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
11423 11424
11424 bool threw; 11425 bool threw;
11425 Execution::Call(isolate, 11426 Execution::Call(isolate,
11426 Handle<JSFunction>(isolate->observers_end_perform_splice()), 11427 Handle<JSFunction>(isolate->observers_end_perform_splice()),
11427 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, 11428 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args,
11428 &threw); 11429 &threw);
11429 ASSERT(!threw); 11430 ASSERT(!threw);
11430 } 11431 }
11431 11432
11432 11433
11434 // TODO(ishell): Temporary wrapper until handlified.
11435 // static
11436 Handle<Object> JSArray::SetElementsLength(Handle<JSArray> array,
11437 Handle<Object> length) {
11438 CALL_HEAP_FUNCTION(array->GetIsolate(),
11439 array->SetElementsLength(*length),
11440 Object);
11441 }
11442
11443
11433 MaybeObject* JSArray::SetElementsLength(Object* len) { 11444 MaybeObject* JSArray::SetElementsLength(Object* len) {
11434 // We should never end in here with a pixel or external array. 11445 // We should never end in here with a pixel or external array.
11435 ASSERT(AllowsSetElementsLength()); 11446 ASSERT(AllowsSetElementsLength());
11436 if (!map()->is_observed()) 11447 if (!map()->is_observed())
11437 return GetElementsAccessor()->SetLength(this, len); 11448 return GetElementsAccessor()->SetLength(this, len);
11438 11449
11439 Isolate* isolate = GetIsolate(); 11450 Isolate* isolate = GetIsolate();
11440 HandleScope scope(isolate); 11451 HandleScope scope(isolate);
11441 Handle<JSArray> self(this); 11452 Handle<JSArray> self(this);
11442 List<uint32_t> indices; 11453 List<uint32_t> indices;
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
11886 // map go generic. 11897 // map go generic.
11887 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); 11898 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC);
11888 } 11899 }
11889 11900
11890 heap->ClearInstanceofCache(); 11901 heap->ClearInstanceofCache();
11891 ASSERT(size == object->Size()); 11902 ASSERT(size == object->Size());
11892 return value; 11903 return value;
11893 } 11904 }
11894 11905
11895 11906
11907 // TODO(ishell): temporary wrapper until handilfied.
11908 // static
11909 void JSObject::EnsureCanContainElements(Handle<JSObject> object,
11910 Arguments* args,
11911 uint32_t first_arg,
11912 uint32_t arg_count,
11913 EnsureElementsMode mode) {
11914 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(),
11915 object->EnsureCanContainElements(args,
11916 first_arg,
11917 arg_count,
11918 mode));
11919 }
11920
11921
11896 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args, 11922 MaybeObject* JSObject::EnsureCanContainElements(Arguments* args,
11897 uint32_t first_arg, 11923 uint32_t first_arg,
11898 uint32_t arg_count, 11924 uint32_t arg_count,
11899 EnsureElementsMode mode) { 11925 EnsureElementsMode mode) {
11900 // Elements in |Arguments| are ordered backwards (because they're on the 11926 // 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 11927 // stack), but the method that's called here iterates over them in forward
11902 // direction. 11928 // direction.
11903 return EnsureCanContainElements( 11929 return EnsureCanContainElements(
11904 args->arguments() - first_arg - (arg_count - 1), 11930 args->arguments() - first_arg - (arg_count - 1),
11905 arg_count, mode); 11931 arg_count, mode);
(...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after
16492 #define ERROR_MESSAGES_TEXTS(C, T) T, 16518 #define ERROR_MESSAGES_TEXTS(C, T) T,
16493 static const char* error_messages_[] = { 16519 static const char* error_messages_[] = {
16494 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16520 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16495 }; 16521 };
16496 #undef ERROR_MESSAGES_TEXTS 16522 #undef ERROR_MESSAGES_TEXTS
16497 return error_messages_[reason]; 16523 return error_messages_[reason];
16498 } 16524 }
16499 16525
16500 16526
16501 } } // namespace v8::internal 16527 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698