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

Unified Diff: src/runtime.cc

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make double support consistent. Now DOUBLE always contains smi or heapnumber Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index cd1af05d578d59dd268d3adfc289388e143cf551..6ebbb2f6b7e250811360185c115276e8e516ab54 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -249,6 +249,11 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
boilerplate, KEEP_INOBJECT_PROPERTIES, length / 2);
}
+ // TODO(verwaest): This does not catch the case where the object stays in fast
+ // most from the beginning. However, since it may go slow by adding
+ // properties, currently only assume we'll ever be fast if we ensure
+ // converting it back to fast mode.
+ bool will_be_fast = should_transform && !has_function_literal;
for (int index = 0; index < length; index +=2) {
Handle<Object> key(constant_properties->get(index+0), isolate);
Handle<Object> value(constant_properties->get(index+1), isolate);
@@ -258,6 +263,13 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
Handle<FixedArray> array = Handle<FixedArray>::cast(value);
value = CreateLiteralBoilerplate(isolate, literals, array);
if (value.is_null()) return value;
+ } else if (value->IsUndefined()) {
+ // TODO(verwaest): Support storage types in the boilerplate.
+ // if (will_be_fast) {
+ // value = isolate->factory()->the_hole_value();
+ // } else {
+ // value = Handle<Object>(Smi::FromInt(0), isolate);
+ // }
}
Handle<Object> result;
uint32_t element_index = 0;
@@ -299,7 +311,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
// containing function literals we defer this operation until after all
// computed properties have been assigned so that we can generate
// constant function properties.
- if (should_transform && !has_function_literal) {
+ if (will_be_fast) {
JSObject::TransformToFastProperties(
boilerplate, boilerplate->map()->unused_property_fields());
}
@@ -7483,18 +7495,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
}
-static void TrySettingInlineConstructStub(Isolate* isolate,
- Handle<JSFunction> function) {
- Handle<Object> prototype = isolate->factory()->null_value();
- if (function->has_instance_prototype()) {
- prototype = Handle<Object>(function->instance_prototype(), isolate);
- }
- if (function->shared()->CanGenerateInlineConstructor(*prototype)) {
- ConstructStubCompiler compiler(isolate);
- Handle<Code> code = compiler.CompileConstructStub(function);
- function->shared()->set_construct_stub(*code);
- }
-}
+// static void TrySettingInlineConstructStub(Isolate* isolate,
+// Handle<JSFunction> function) {
+// Handle<Object> prototype = isolate->factory()->null_value();
+// if (function->has_instance_prototype()) {
+// prototype = Handle<Object>(function->instance_prototype(), isolate);
+// }
+// if (function->shared()->CanGenerateInlineConstructor(*prototype)) {
+// ConstructStubCompiler compiler(isolate);
+// Handle<Code> code = compiler.CompileConstructStub(function);
+// function->shared()->set_construct_stub(*code);
+// }
+// }
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
@@ -7560,13 +7572,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) {
shared->CompleteInobjectSlackTracking();
}
- bool first_allocation = !shared->live_objects_may_exist();
+ // bool first_allocation = !shared->live_objects_may_exist();
Handle<JSObject> result = isolate->factory()->NewJSObject(function);
RETURN_IF_EMPTY_HANDLE(isolate, result);
// Delay setting the stub if inobject slack tracking is in progress.
- if (first_allocation && !shared->IsInobjectSlackTrackingInProgress()) {
- TrySettingInlineConstructStub(isolate, function);
- }
+ // if (first_allocation && !shared->IsInobjectSlackTrackingInProgress()) {
+ // TrySettingInlineConstructStub(isolate, function);
+ // }
isolate->counters()->constructed_objects()->Increment();
isolate->counters()->constructed_objects_runtime()->Increment();
@@ -7581,7 +7593,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FinalizeInstanceSize) {
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
function->shared()->CompleteInobjectSlackTracking();
- TrySettingInlineConstructStub(isolate, function);
+ // TrySettingInlineConstructStub(isolate, function);
return isolate->heap()->undefined_value();
}
« src/objects.cc ('K') | « src/property-details.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698