| OLD | NEW |
| 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 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2447 | 2447 |
| 2448 { | 2448 { |
| 2449 HPhase phase("H_Block building"); | 2449 HPhase phase("H_Block building"); |
| 2450 current_block_ = graph()->entry_block(); | 2450 current_block_ = graph()->entry_block(); |
| 2451 | 2451 |
| 2452 Scope* scope = info()->scope(); | 2452 Scope* scope = info()->scope(); |
| 2453 if (scope->HasIllegalRedeclaration()) { | 2453 if (scope->HasIllegalRedeclaration()) { |
| 2454 Bailout("function with illegal redeclaration"); | 2454 Bailout("function with illegal redeclaration"); |
| 2455 return NULL; | 2455 return NULL; |
| 2456 } | 2456 } |
| 2457 if (scope->calls_eval()) { |
| 2458 Bailout("function calls eval"); |
| 2459 return NULL; |
| 2460 } |
| 2457 SetUpScope(scope); | 2461 SetUpScope(scope); |
| 2458 | 2462 |
| 2459 // Add an edge to the body entry. This is warty: the graph's start | 2463 // Add an edge to the body entry. This is warty: the graph's start |
| 2460 // environment will be used by the Lithium translation as the initial | 2464 // environment will be used by the Lithium translation as the initial |
| 2461 // environment on graph entry, but it has now been mutated by the | 2465 // environment on graph entry, but it has now been mutated by the |
| 2462 // Hydrogen translation of the instructions in the start block. This | 2466 // Hydrogen translation of the instructions in the start block. This |
| 2463 // environment uses values which have not been defined yet. These | 2467 // environment uses values which have not been defined yet. These |
| 2464 // Hydrogen instructions will then be replayed by the Lithium | 2468 // Hydrogen instructions will then be replayed by the Lithium |
| 2465 // translation, so they cannot have an environment effect. The edge to | 2469 // translation, so they cannot have an environment effect. The edge to |
| 2466 // the body's entry block (along with some special logic for the start | 2470 // the body's entry block (along with some special logic for the start |
| (...skipping 3391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5858 HValue* context = environment()->LookupContext(); | 5862 HValue* context = environment()->LookupContext(); |
| 5859 call = PreProcessCall( | 5863 call = PreProcessCall( |
| 5860 new(zone()) HCallNamed(context, name, argument_count)); | 5864 new(zone()) HCallNamed(context, name, argument_count)); |
| 5861 } | 5865 } |
| 5862 | 5866 |
| 5863 } else { | 5867 } else { |
| 5864 expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); | 5868 expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); |
| 5865 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 5869 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 5866 bool global_call = proxy != NULL && proxy->var()->IsUnallocated(); | 5870 bool global_call = proxy != NULL && proxy->var()->IsUnallocated(); |
| 5867 | 5871 |
| 5872 if (proxy != NULL && proxy->var()->is_possibly_eval()) { |
| 5873 return Bailout("possible direct call to eval"); |
| 5874 } |
| 5875 |
| 5868 if (global_call) { | 5876 if (global_call) { |
| 5869 Variable* var = proxy->var(); | 5877 Variable* var = proxy->var(); |
| 5870 bool known_global_function = false; | 5878 bool known_global_function = false; |
| 5871 // If there is a global property cell for the name at compile time and | 5879 // If there is a global property cell for the name at compile time and |
| 5872 // access check is not enabled we assume that the function will not change | 5880 // access check is not enabled we assume that the function will not change |
| 5873 // and generate optimized code for calling the function. | 5881 // and generate optimized code for calling the function. |
| 5874 LookupResult lookup(isolate()); | 5882 LookupResult lookup(isolate()); |
| 5875 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); | 5883 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); |
| 5876 if (type == kUseCell && | 5884 if (type == kUseCell && |
| 5877 !info()->global_object()->IsAccessCheckNeeded()) { | 5885 !info()->global_object()->IsAccessCheckNeeded()) { |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8161 } | 8169 } |
| 8162 } | 8170 } |
| 8163 | 8171 |
| 8164 #ifdef DEBUG | 8172 #ifdef DEBUG |
| 8165 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8173 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 8166 if (allocator_ != NULL) allocator_->Verify(); | 8174 if (allocator_ != NULL) allocator_->Verify(); |
| 8167 #endif | 8175 #endif |
| 8168 } | 8176 } |
| 8169 | 8177 |
| 8170 } } // namespace v8::internal | 8178 } } // namespace v8::internal |
| OLD | NEW |