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

Side by Side Diff: src/factory.cc

Issue 10209027: Implement tracking and optimizations of packed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: New upload Created 8 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // Set up the code pointer in both the shared function info and in 768 // Set up the code pointer in both the shared function info and in
769 // the function itself. 769 // the function itself.
770 function->shared()->set_code(*code); 770 function->shared()->set_code(*code);
771 function->set_code(*code); 771 function->set_code(*code);
772 772
773 if (force_initial_map || 773 if (force_initial_map ||
774 type != JS_OBJECT_TYPE || 774 type != JS_OBJECT_TYPE ||
775 instance_size != JSObject::kHeaderSize) { 775 instance_size != JSObject::kHeaderSize) {
776 Handle<Map> initial_map = NewMap(type, 776 Handle<Map> initial_map = NewMap(type,
777 instance_size, 777 instance_size,
778 FAST_SMI_ONLY_ELEMENTS); 778 INITIAL_FAST_ELEMENTS_KIND);
779 function->set_initial_map(*initial_map); 779 function->set_initial_map(*initial_map);
780 initial_map->set_constructor(*function); 780 initial_map->set_constructor(*function);
781 } 781 }
782 782
783 // Set function.prototype and give the prototype a constructor 783 // Set function.prototype and give the prototype a constructor
784 // property that refers to the function. 784 // property that refers to the function.
785 SetPrototypeProperty(function, prototype); 785 SetPrototypeProperty(function, prototype);
786 // Currently safe because it is only invoked from Genesis. 786 // Currently safe because it is only invoked from Genesis.
787 CHECK_NOT_EMPTY_HANDLE(isolate(), 787 CHECK_NOT_EMPTY_HANDLE(isolate(),
788 JSObject::SetLocalPropertyIgnoreAttributes( 788 JSObject::SetLocalPropertyIgnoreAttributes(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 PretenureFlag pretenure) { 979 PretenureFlag pretenure) {
980 CALL_HEAP_FUNCTION( 980 CALL_HEAP_FUNCTION(
981 isolate(), 981 isolate(),
982 isolate()->heap()->AllocateJSArrayWithElements(*elements, 982 isolate()->heap()->AllocateJSArrayWithElements(*elements,
983 elements_kind, 983 elements_kind,
984 pretenure), 984 pretenure),
985 JSArray); 985 JSArray);
986 } 986 }
987 987
988 988
989 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, 989 void Factory::SetElementsCapacityAndLength(
990 int capacity, 990 Handle<JSArray> array,
991 int length) { 991 int capacity,
992 int length) {
992 ElementsAccessor* accessor = array->GetElementsAccessor(); 993 ElementsAccessor* accessor = array->GetElementsAccessor();
993 CALL_HEAP_FUNCTION_VOID( 994 CALL_HEAP_FUNCTION_VOID(
994 isolate(), 995 isolate(),
995 accessor->SetCapacityAndLength(*array, capacity, length)); 996 accessor->SetCapacityAndLength(*array, capacity, length));
996 } 997 }
997 998
998 999
999 void Factory::SetContent(Handle<JSArray> array, 1000 void Factory::SetContent(Handle<JSArray> array,
1000 Handle<FixedArrayBase> elements) { 1001 Handle<FixedArrayBase> elements) {
1001 CALL_HEAP_FUNCTION_VOID( 1002 CALL_HEAP_FUNCTION_VOID(
1002 isolate(), 1003 isolate(),
1003 array->SetContent(*elements)); 1004 array->SetContent(*elements));
1004 } 1005 }
1005 1006
1006 1007
1007 void Factory::EnsureCanContainHeapObjectElements(Handle<JSArray> array) { 1008 void Factory::EnsureCanContainHeapObjectElements(Handle<JSArray> array) {
1008 CALL_HEAP_FUNCTION_VOID( 1009 CALL_HEAP_FUNCTION_VOID(
1009 isolate(), 1010 isolate(),
1010 array->EnsureCanContainHeapObjectElements()); 1011 array->EnsureCanContainHeapObjectElements());
1011 } 1012 }
1012 1013
1013 1014
1014 void Factory::EnsureCanContainElements(Handle<JSArray> array, 1015 void Factory::EnsureCanContainElements(Handle<JSArray> array,
1015 Handle<FixedArrayBase> elements, 1016 Handle<FixedArrayBase> elements,
1017 uint32_t length,
1016 EnsureElementsMode mode) { 1018 EnsureElementsMode mode) {
1017 CALL_HEAP_FUNCTION_VOID( 1019 CALL_HEAP_FUNCTION_VOID(
1018 isolate(), 1020 isolate(),
1019 array->EnsureCanContainElements(*elements, mode)); 1021 array->EnsureCanContainElements(*elements, length, mode));
1020 } 1022 }
1021 1023
1022 1024
1023 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, 1025 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler,
1024 Handle<Object> prototype) { 1026 Handle<Object> prototype) {
1025 CALL_HEAP_FUNCTION( 1027 CALL_HEAP_FUNCTION(
1026 isolate(), 1028 isolate(),
1027 isolate()->heap()->AllocateJSProxy(*handler, *prototype), 1029 isolate()->heap()->AllocateJSProxy(*handler, *prototype),
1028 JSProxy); 1030 JSProxy);
1029 } 1031 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 1442
1441 1443
1442 Handle<Object> Factory::ToBoolean(bool value) { 1444 Handle<Object> Factory::ToBoolean(bool value) {
1443 return Handle<Object>(value 1445 return Handle<Object>(value
1444 ? isolate()->heap()->true_value() 1446 ? isolate()->heap()->true_value()
1445 : isolate()->heap()->false_value()); 1447 : isolate()->heap()->false_value());
1446 } 1448 }
1447 1449
1448 1450
1449 } } // namespace v8::internal 1451 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698