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

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

Issue 656423004: Narrow cases where Sparse/Smart versions of Array methods are used (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added more tests Created 6 years, 1 month 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/runtime/runtime.h ('k') | test/mjsunit/array-natives-elements.js » ('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/runtime/runtime-utils.h" 8 #include "src/runtime/runtime-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 HandleScope scope(isolate); 1036 HandleScope scope(isolate);
1037 DCHECK(args.length() == 1); 1037 DCHECK(args.length() == 1);
1038 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); 1038 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
1039 RUNTIME_ASSERT(!array->HasExternalArrayElements() && 1039 RUNTIME_ASSERT(!array->HasExternalArrayElements() &&
1040 !array->HasFixedTypedArrayElements()); 1040 !array->HasFixedTypedArrayElements());
1041 JSObject::NormalizeElements(array); 1041 JSObject::NormalizeElements(array);
1042 return *array; 1042 return *array;
1043 } 1043 }
1044 1044
1045 1045
1046 RUNTIME_FUNCTION(Runtime_HasComplexElements) {
1047 HandleScope scope(isolate);
1048 DCHECK(args.length() == 1);
1049 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
1050 for (PrototypeIterator iter(isolate, array,
1051 PrototypeIterator::START_AT_RECEIVER);
1052 !iter.IsAtEnd(); iter.Advance()) {
1053 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
1054 return isolate->heap()->true_value();
1055 }
1056 Handle<JSObject> current =
1057 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
1058 if (current->HasIndexedInterceptor()) {
1059 return isolate->heap()->true_value();
1060 }
1061 if (!current->HasDictionaryElements()) continue;
1062 if (current->element_dictionary()->HasComplexElements()) {
1063 return isolate->heap()->true_value();
1064 }
1065 }
1066 return isolate->heap()->false_value();
1067 }
1068
1069
1046 // TODO(dcarney): remove this function when TurboFan supports it. 1070 // TODO(dcarney): remove this function when TurboFan supports it.
1047 // Takes the object to be iterated over and the result of GetPropertyNamesFast 1071 // Takes the object to be iterated over and the result of GetPropertyNamesFast
1048 // Returns pair (cache_array, cache_type). 1072 // Returns pair (cache_array, cache_type).
1049 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInInit) { 1073 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_ForInInit) {
1050 SealHandleScope scope(isolate); 1074 SealHandleScope scope(isolate);
1051 DCHECK(args.length() == 2); 1075 DCHECK(args.length() == 2);
1052 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs. 1076 // This simulates CONVERT_ARG_HANDLE_CHECKED for calls returning pairs.
1053 // Not worth creating a macro atm as this function should be removed. 1077 // Not worth creating a macro atm as this function should be removed.
1054 if (!args[0]->IsJSReceiver() || !args[1]->IsObject()) { 1078 if (!args[0]->IsJSReceiver() || !args[1]->IsObject()) {
1055 Object* error = isolate->ThrowIllegalOperation(); 1079 Object* error = isolate->ThrowIllegalOperation();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } 1175 }
1152 1176
1153 1177
1154 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) { 1178 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) {
1155 SealHandleScope shs(isolate); 1179 SealHandleScope shs(isolate);
1156 DCHECK(args.length() == 2); 1180 DCHECK(args.length() == 2);
1157 return isolate->heap()->undefined_value(); 1181 return isolate->heap()->undefined_value();
1158 } 1182 }
1159 } 1183 }
1160 } // namespace v8::internal 1184 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/array-natives-elements.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698