OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 Push(Add<HLoadKeyed>(number_string_cache, value_index, | 1926 Push(Add<HLoadKeyed>(number_string_cache, value_index, |
1927 static_cast<HValue*>(NULL), | 1927 static_cast<HValue*>(NULL), |
1928 FAST_ELEMENTS, ALLOW_RETURN_HOLE)); | 1928 FAST_ELEMENTS, ALLOW_RETURN_HOLE)); |
1929 } | 1929 } |
1930 if_found.Else(); | 1930 if_found.Else(); |
1931 { | 1931 { |
1932 // Cache miss, fallback to runtime. | 1932 // Cache miss, fallback to runtime. |
1933 Add<HPushArguments>(object); | 1933 Add<HPushArguments>(object); |
1934 Push(Add<HCallRuntime>( | 1934 Push(Add<HCallRuntime>( |
1935 isolate()->factory()->empty_string(), | 1935 isolate()->factory()->empty_string(), |
1936 Runtime::FunctionForId(Runtime::kHiddenNumberToStringSkipCache), | 1936 Runtime::FunctionForId(Runtime::kNumberToStringSkipCache), |
1937 1)); | 1937 1)); |
1938 } | 1938 } |
1939 if_found.End(); | 1939 if_found.End(); |
1940 | 1940 |
1941 return Pop(); | 1941 return Pop(); |
1942 } | 1942 } |
1943 | 1943 |
1944 | 1944 |
1945 HAllocate* HGraphBuilder::BuildAllocate( | 1945 HAllocate* HGraphBuilder::BuildAllocate( |
1946 HValue* object_size, | 1946 HValue* object_size, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 | 2250 |
2251 // Return the sequential string. | 2251 // Return the sequential string. |
2252 Push(result); | 2252 Push(result); |
2253 } | 2253 } |
2254 if_sameencodingandsequential.Else(); | 2254 if_sameencodingandsequential.Else(); |
2255 { | 2255 { |
2256 // Fallback to the runtime to add the two strings. | 2256 // Fallback to the runtime to add the two strings. |
2257 Add<HPushArguments>(left, right); | 2257 Add<HPushArguments>(left, right); |
2258 Push(Add<HCallRuntime>( | 2258 Push(Add<HCallRuntime>( |
2259 isolate()->factory()->empty_string(), | 2259 isolate()->factory()->empty_string(), |
2260 Runtime::FunctionForId(Runtime::kHiddenStringAdd), | 2260 Runtime::FunctionForId(Runtime::kStringAdd), |
2261 2)); | 2261 2)); |
2262 } | 2262 } |
2263 if_sameencodingandsequential.End(); | 2263 if_sameencodingandsequential.End(); |
2264 } | 2264 } |
2265 if_createcons.End(); | 2265 if_createcons.End(); |
2266 | 2266 |
2267 return Pop(); | 2267 return Pop(); |
2268 } | 2268 } |
2269 | 2269 |
2270 | 2270 |
(...skipping 3205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; | 5476 ? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags; |
5477 | 5477 |
5478 Add<HPushArguments>(Add<HConstant>(closure_literals), | 5478 Add<HPushArguments>(Add<HConstant>(closure_literals), |
5479 Add<HConstant>(literal_index), | 5479 Add<HConstant>(literal_index), |
5480 Add<HConstant>(constant_properties), | 5480 Add<HConstant>(constant_properties), |
5481 Add<HConstant>(flags)); | 5481 Add<HConstant>(flags)); |
5482 | 5482 |
5483 // TODO(mvstanton): Add a flag to turn off creation of any | 5483 // TODO(mvstanton): Add a flag to turn off creation of any |
5484 // AllocationMementos for this call: we are in crankshaft and should have | 5484 // AllocationMementos for this call: we are in crankshaft and should have |
5485 // learned enough about transition behavior to stop emitting mementos. | 5485 // learned enough about transition behavior to stop emitting mementos. |
5486 Runtime::FunctionId function_id = Runtime::kHiddenCreateObjectLiteral; | 5486 Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral; |
5487 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5487 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
5488 Runtime::FunctionForId(function_id), | 5488 Runtime::FunctionForId(function_id), |
5489 4); | 5489 4); |
5490 } | 5490 } |
5491 | 5491 |
5492 // The object is expected in the bailout environment during computation | 5492 // The object is expected in the bailout environment during computation |
5493 // of the property values and is the value of the entire expression. | 5493 // of the property values and is the value of the entire expression. |
5494 Push(literal); | 5494 Push(literal); |
5495 | 5495 |
5496 expr->CalculateEmitStore(zone()); | 5496 expr->CalculateEmitStore(zone()); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5634 flags |= ArrayLiteral::kDisableMementos; | 5634 flags |= ArrayLiteral::kDisableMementos; |
5635 | 5635 |
5636 Add<HPushArguments>(Add<HConstant>(literals), | 5636 Add<HPushArguments>(Add<HConstant>(literals), |
5637 Add<HConstant>(literal_index), | 5637 Add<HConstant>(literal_index), |
5638 Add<HConstant>(constants), | 5638 Add<HConstant>(constants), |
5639 Add<HConstant>(flags)); | 5639 Add<HConstant>(flags)); |
5640 | 5640 |
5641 // TODO(mvstanton): Consider a flag to turn off creation of any | 5641 // TODO(mvstanton): Consider a flag to turn off creation of any |
5642 // AllocationMementos for this call: we are in crankshaft and should have | 5642 // AllocationMementos for this call: we are in crankshaft and should have |
5643 // learned enough about transition behavior to stop emitting mementos. | 5643 // learned enough about transition behavior to stop emitting mementos. |
5644 Runtime::FunctionId function_id = Runtime::kHiddenCreateArrayLiteral; | 5644 Runtime::FunctionId function_id = Runtime::kCreateArrayLiteral; |
5645 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), | 5645 literal = Add<HCallRuntime>(isolate()->factory()->empty_string(), |
5646 Runtime::FunctionForId(function_id), | 5646 Runtime::FunctionForId(function_id), |
5647 4); | 5647 4); |
5648 | 5648 |
5649 // De-opt if elements kind changed from boilerplate_elements_kind. | 5649 // De-opt if elements kind changed from boilerplate_elements_kind. |
5650 Handle<Map> map = Handle<Map>(boilerplate_object->map(), isolate()); | 5650 Handle<Map> map = Handle<Map>(boilerplate_object->map(), isolate()); |
5651 literal = Add<HCheckMaps>(literal, map); | 5651 literal = Add<HCheckMaps>(literal, map); |
5652 } | 5652 } |
5653 | 5653 |
5654 // The array is expected in the bailout environment during computation | 5654 // The array is expected in the bailout environment during computation |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6646 // We don't optimize functions with invalid left-hand sides in | 6646 // We don't optimize functions with invalid left-hand sides in |
6647 // assignments, count operations, or for-in. Consequently throw can | 6647 // assignments, count operations, or for-in. Consequently throw can |
6648 // currently only occur in an effect context. | 6648 // currently only occur in an effect context. |
6649 ASSERT(ast_context()->IsEffect()); | 6649 ASSERT(ast_context()->IsEffect()); |
6650 CHECK_ALIVE(VisitForValue(expr->exception())); | 6650 CHECK_ALIVE(VisitForValue(expr->exception())); |
6651 | 6651 |
6652 HValue* value = environment()->Pop(); | 6652 HValue* value = environment()->Pop(); |
6653 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); | 6653 if (!FLAG_hydrogen_track_positions) SetSourcePosition(expr->position()); |
6654 Add<HPushArguments>(value); | 6654 Add<HPushArguments>(value); |
6655 Add<HCallRuntime>(isolate()->factory()->empty_string(), | 6655 Add<HCallRuntime>(isolate()->factory()->empty_string(), |
6656 Runtime::FunctionForId(Runtime::kHiddenThrow), 1); | 6656 Runtime::FunctionForId(Runtime::kThrow), 1); |
6657 Add<HSimulate>(expr->id()); | 6657 Add<HSimulate>(expr->id()); |
6658 | 6658 |
6659 // If the throw definitely exits the function, we can finish with a dummy | 6659 // If the throw definitely exits the function, we can finish with a dummy |
6660 // control flow at this point. This is not the case if the throw is inside | 6660 // control flow at this point. This is not the case if the throw is inside |
6661 // an inlined function which may be replaced. | 6661 // an inlined function which may be replaced. |
6662 if (call_context() == NULL) { | 6662 if (call_context() == NULL) { |
6663 FinishExitCurrentBlock(New<HAbnormalExit>()); | 6663 FinishExitCurrentBlock(New<HAbnormalExit>()); |
6664 } | 6664 } |
6665 } | 6665 } |
6666 | 6666 |
(...skipping 5682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12349 if (ShouldProduceTraceOutput()) { | 12349 if (ShouldProduceTraceOutput()) { |
12350 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12350 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12351 } | 12351 } |
12352 | 12352 |
12353 #ifdef DEBUG | 12353 #ifdef DEBUG |
12354 graph_->Verify(false); // No full verify. | 12354 graph_->Verify(false); // No full verify. |
12355 #endif | 12355 #endif |
12356 } | 12356 } |
12357 | 12357 |
12358 } } // namespace v8::internal | 12358 } } // namespace v8::internal |
OLD | NEW |