OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4328 | 4328 |
4329 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { | 4329 void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
4330 ASSERT(!HasStackOverflow()); | 4330 ASSERT(!HasStackOverflow()); |
4331 ASSERT(current_block() != NULL); | 4331 ASSERT(current_block() != NULL); |
4332 ASSERT(current_block()->HasPredecessor()); | 4332 ASSERT(current_block()->HasPredecessor()); |
4333 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); | 4333 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); |
4334 HInstruction* literal; | 4334 HInstruction* literal; |
4335 | 4335 |
4336 // Check whether to use fast or slow deep-copying for boilerplate. | 4336 // Check whether to use fast or slow deep-copying for boilerplate. |
4337 int max_properties = kMaxFastLiteralProperties; | 4337 int max_properties = kMaxFastLiteralProperties; |
4338 Handle<Object> boilerplate(closure->literals()->get( | 4338 Handle<Object> literals_cell(closure->literals()->get(expr->literal_index()), |
4339 expr->literal_index()), isolate()); | 4339 isolate()); |
4340 if (boilerplate->IsJSObject() && | 4340 Handle<AllocationSite> site; |
4341 IsFastLiteral(Handle<JSObject>::cast(boilerplate), | 4341 Handle<JSObject> boilerplate; |
4342 kMaxFastLiteralDepth, | 4342 if (!literals_cell->IsUndefined()) { |
4343 &max_properties)) { | 4343 // Retrieve the boilerplate |
4344 Handle<JSObject> boilerplate_object = Handle<JSObject>::cast(boilerplate); | 4344 site = Handle<AllocationSite>::cast(literals_cell); |
| 4345 boilerplate = Handle<JSObject>(JSObject::cast(site->transition_info()), |
| 4346 isolate()); |
| 4347 } |
4345 | 4348 |
4346 literal = BuildFastLiteral(boilerplate_object); | 4349 if (!boilerplate.is_null() && |
| 4350 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
| 4351 literal = BuildFastLiteral(boilerplate); |
4347 } else { | 4352 } else { |
4348 NoObservableSideEffectsScope no_effects(this); | 4353 NoObservableSideEffectsScope no_effects(this); |
4349 Handle<FixedArray> closure_literals(closure->literals(), isolate()); | 4354 Handle<FixedArray> closure_literals(closure->literals(), isolate()); |
4350 Handle<FixedArray> constant_properties = expr->constant_properties(); | 4355 Handle<FixedArray> constant_properties = expr->constant_properties(); |
4351 int literal_index = expr->literal_index(); | 4356 int literal_index = expr->literal_index(); |
4352 int flags = expr->fast_elements() | 4357 int flags = expr->fast_elements() |
4353 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; | 4358 ? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags; |
4354 flags |= expr->has_function() | 4359 flags |= expr->has_function() |
4355 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; | 4360 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; |
4356 | 4361 |
(...skipping 5518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9875 if (ShouldProduceTraceOutput()) { | 9880 if (ShouldProduceTraceOutput()) { |
9876 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9881 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9877 } | 9882 } |
9878 | 9883 |
9879 #ifdef DEBUG | 9884 #ifdef DEBUG |
9880 graph_->Verify(false); // No full verify. | 9885 graph_->Verify(false); // No full verify. |
9881 #endif | 9886 #endif |
9882 } | 9887 } |
9883 | 9888 |
9884 } } // namespace v8::internal | 9889 } } // namespace v8::internal |
OLD | NEW |