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

Side by Side Diff: src/bootstrapper.cc

Issue 7901016: Basic support for tracking smi-only arrays on ia32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ready to land Created 9 years, 3 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/arm/stub-cache-arm.cc ('k') | src/builtins.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 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map); 1069 Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
1070 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); 1070 new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
1071 // Set up a well-formed parameter map to make assertions happy. 1071 // Set up a well-formed parameter map to make assertions happy.
1072 Handle<FixedArray> elements = factory->NewFixedArray(2); 1072 Handle<FixedArray> elements = factory->NewFixedArray(2);
1073 elements->set_map(heap->non_strict_arguments_elements_map()); 1073 elements->set_map(heap->non_strict_arguments_elements_map());
1074 Handle<FixedArray> array; 1074 Handle<FixedArray> array;
1075 array = factory->NewFixedArray(0); 1075 array = factory->NewFixedArray(0);
1076 elements->set(0, *array); 1076 elements->set(0, *array);
1077 array = factory->NewFixedArray(0); 1077 array = factory->NewFixedArray(0);
1078 elements->set(1, *array); 1078 elements->set(1, *array);
1079 Handle<Map> non_strict_arguments_elements_map =
1080 factory->GetElementsTransitionMap(result,
fschneider 2011/10/18 10:30:20 Is this call really necessary? It seems that this
1081 NON_STRICT_ARGUMENTS_ELEMENTS);
1082 result->set_map(*non_strict_arguments_elements_map);
1083 ASSERT(result->HasNonStrictArgumentsElements());
1079 result->set_elements(*elements); 1084 result->set_elements(*elements);
1080 global_context()->set_aliased_arguments_boilerplate(*result); 1085 global_context()->set_aliased_arguments_boilerplate(*result);
1081 } 1086 }
1082 1087
1083 { // --- strict mode arguments boilerplate 1088 { // --- strict mode arguments boilerplate
1084 const PropertyAttributes attributes = 1089 const PropertyAttributes attributes =
1085 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 1090 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1086 1091
1087 // Create the ThrowTypeError functions. 1092 // Create the ThrowTypeError functions.
1088 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED); 1093 Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 Builtins::kArrayCode, 1555 Builtins::kArrayCode,
1551 true); 1556 true);
1552 Handle<JSObject> prototype = 1557 Handle<JSObject> prototype =
1553 factory()->NewJSObject(isolate()->object_function(), TENURED); 1558 factory()->NewJSObject(isolate()->object_function(), TENURED);
1554 SetPrototype(array_function, prototype); 1559 SetPrototype(array_function, prototype);
1555 1560
1556 array_function->shared()->set_construct_stub( 1561 array_function->shared()->set_construct_stub(
1557 isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); 1562 isolate()->builtins()->builtin(Builtins::kArrayConstructCode));
1558 array_function->shared()->DontAdaptArguments(); 1563 array_function->shared()->DontAdaptArguments();
1559 1564
1565 // InternalArrays should not use Smi-Only array optimizations. There are too
1566 // many places in the C++ runtime code (e.g. RegEx) that assume that
1567 // elements in InternalArrays can be set to non-Smi values without going
1568 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT
1569 // transition easy to trap. Moreover, they rarely are smi-only.
1570 MaybeObject* maybe_map =
1571 array_function->initial_map()->CopyDropTransitions();
1572 Map* new_map;
1573 if (!maybe_map->To<Map>(&new_map)) return maybe_map;
1574 new_map->set_elements_kind(FAST_ELEMENTS);
1575 array_function->set_initial_map(new_map);
1576
1560 // Make "length" magic on instances. 1577 // Make "length" magic on instances.
1561 Handle<DescriptorArray> array_descriptors = 1578 Handle<DescriptorArray> array_descriptors =
1562 factory()->CopyAppendForeignDescriptor( 1579 factory()->CopyAppendForeignDescriptor(
1563 factory()->empty_descriptor_array(), 1580 factory()->empty_descriptor_array(),
1564 factory()->length_symbol(), 1581 factory()->length_symbol(),
1565 factory()->NewForeign(&Accessors::ArrayLength), 1582 factory()->NewForeign(&Accessors::ArrayLength),
1566 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); 1583 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
1567 1584
1568 array_function->initial_map()->set_instance_descriptors( 1585 array_function->initial_map()->set_instance_descriptors(
1569 *array_descriptors); 1586 *array_descriptors);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 return from + sizeof(NestingCounterType); 2245 return from + sizeof(NestingCounterType);
2229 } 2246 }
2230 2247
2231 2248
2232 // Called when the top-level V8 mutex is destroyed. 2249 // Called when the top-level V8 mutex is destroyed.
2233 void Bootstrapper::FreeThreadResources() { 2250 void Bootstrapper::FreeThreadResources() {
2234 ASSERT(!IsActive()); 2251 ASSERT(!IsActive());
2235 } 2252 }
2236 2253
2237 } } // namespace v8::internal 2254 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698