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

Side by Side Diff: src/factory.cc

Issue 8820014: Support Smi->Double->HeapObject transitions in constructed Arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disable smi only array optimizations Created 9 years 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 919
920 Handle<JSArray> Factory::NewJSArray(int capacity, 920 Handle<JSArray> Factory::NewJSArray(int capacity,
921 PretenureFlag pretenure) { 921 PretenureFlag pretenure) {
922 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); 922 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure);
923 CALL_HEAP_FUNCTION(isolate(), 923 CALL_HEAP_FUNCTION(isolate(),
924 Handle<JSArray>::cast(obj)->Initialize(capacity), 924 Handle<JSArray>::cast(obj)->Initialize(capacity),
925 JSArray); 925 JSArray);
926 } 926 }
927 927
928 928
929 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, 929 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements,
930 PretenureFlag pretenure) { 930 PretenureFlag pretenure) {
931 Handle<JSArray> result = 931 Handle<JSArray> result =
932 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), 932 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(),
933 pretenure)); 933 pretenure));
934 result->set_length(Smi::FromInt(0));
934 SetContent(result, elements); 935 SetContent(result, elements);
935 return result; 936 return result;
936 } 937 }
937 938
938 939
939 void Factory::SetContent(Handle<JSArray> array, 940 void Factory::SetContent(Handle<JSArray> array,
940 Handle<FixedArray> elements) { 941 Handle<FixedArrayBase> elements) {
941 CALL_HEAP_FUNCTION_VOID( 942 CALL_HEAP_FUNCTION_VOID(
942 isolate(), 943 isolate(),
943 array->SetContent(*elements)); 944 array->SetContent(*elements));
944 } 945 }
945 946
946 947
947 void Factory::EnsureCanContainNonSmiElements(Handle<JSArray> array) { 948 void Factory::EnsureCanContainHeapObjectElements(Handle<JSArray> array) {
948 CALL_HEAP_FUNCTION_VOID( 949 CALL_HEAP_FUNCTION_VOID(
949 isolate(), 950 isolate(),
950 array->EnsureCanContainNonSmiElements()); 951 array->EnsureCanContainHeapObjectElements());
951 } 952 }
952 953
953 954
955 void Factory::EnsureCanContainElements(Handle<JSArray> array,
956 Handle<FixedArrayBase> elements,
957 EnsureElementsMode mode) {
958 CALL_HEAP_FUNCTION_VOID(
959 isolate(),
960 array->EnsureCanContainElements(*elements, mode));
961 }
962
963
954 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, 964 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler,
955 Handle<Object> prototype) { 965 Handle<Object> prototype) {
956 CALL_HEAP_FUNCTION( 966 CALL_HEAP_FUNCTION(
957 isolate(), 967 isolate(),
958 isolate()->heap()->AllocateJSProxy(*handler, *prototype), 968 isolate()->heap()->AllocateJSProxy(*handler, *prototype),
959 JSProxy); 969 JSProxy);
960 } 970 }
961 971
962 972
963 void Factory::BecomeJSObject(Handle<JSReceiver> object) { 973 void Factory::BecomeJSObject(Handle<JSReceiver> object) {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1371
1362 1372
1363 Handle<Object> Factory::ToBoolean(bool value) { 1373 Handle<Object> Factory::ToBoolean(bool value) {
1364 return Handle<Object>(value 1374 return Handle<Object>(value
1365 ? isolate()->heap()->true_value() 1375 ? isolate()->heap()->true_value()
1366 : isolate()->heap()->false_value()); 1376 : isolate()->heap()->false_value());
1367 } 1377 }
1368 1378
1369 1379
1370 } } // namespace v8::internal 1380 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698