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

Side by Side Diff: src/runtime/runtime-array.cc

Issue 1191313003: More cleanup related to setting array.length (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/objects-inl.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/messages.h" 8 #include "src/messages.h"
9 #include "src/runtime/runtime-utils.h" 9 #include "src/runtime/runtime-utils.h"
10 10
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 Arguments* caller_args) { 1061 Arguments* caller_args) {
1062 Factory* factory = isolate->factory(); 1062 Factory* factory = isolate->factory();
1063 1063
1064 bool holey = false; 1064 bool holey = false;
1065 bool can_use_type_feedback = true; 1065 bool can_use_type_feedback = true;
1066 bool can_inline_array_constructor = true; 1066 bool can_inline_array_constructor = true;
1067 if (caller_args->length() == 1) { 1067 if (caller_args->length() == 1) {
1068 Handle<Object> argument_one = caller_args->at<Object>(0); 1068 Handle<Object> argument_one = caller_args->at<Object>(0);
1069 if (argument_one->IsSmi()) { 1069 if (argument_one->IsSmi()) {
1070 int value = Handle<Smi>::cast(argument_one)->value(); 1070 int value = Handle<Smi>::cast(argument_one)->value();
1071 if (value < 0 || JSArray::SetElementsLengthWouldNormalize(isolate->heap(), 1071 if (value < 0 ||
1072 argument_one)) { 1072 JSArray::SetLengthWouldNormalize(isolate->heap(), value)) {
1073 // the array is a dictionary in this case. 1073 // the array is a dictionary in this case.
1074 can_use_type_feedback = false; 1074 can_use_type_feedback = false;
1075 } else if (value != 0) { 1075 } else if (value != 0) {
1076 holey = true; 1076 holey = true;
1077 if (value >= JSObject::kInitialMaxFastElementArray) { 1077 if (value >= JSObject::kInitialMaxFastElementArray) {
1078 can_inline_array_constructor = false; 1078 can_inline_array_constructor = false;
1079 } 1079 }
1080 } 1080 }
1081 } else { 1081 } else {
1082 // Non-smi length argument produces a dictionary 1082 // Non-smi length argument produces a dictionary
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 1324
1325 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { 1325 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
1326 SealHandleScope shs(isolate); 1326 SealHandleScope shs(isolate);
1327 DCHECK(args.length() == 2); 1327 DCHECK(args.length() == 2);
1328 // Returning undefined means that this fast path fails and one has to resort 1328 // Returning undefined means that this fast path fails and one has to resort
1329 // to a slow path. 1329 // to a slow path.
1330 return isolate->heap()->undefined_value(); 1330 return isolate->heap()->undefined_value();
1331 } 1331 }
1332 } // namespace internal 1332 } // namespace internal
1333 } // namespace v8 1333 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698