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 3462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 HValue* context = environment()->LookupContext(); | 5933 HValue* context = environment()->LookupContext(); |
5930 call = PreProcessCall( | 5934 call = PreProcessCall( |
5931 new(zone()) HCallNamed(context, name, argument_count)); | 5935 new(zone()) HCallNamed(context, name, argument_count)); |
5932 } | 5936 } |
5933 | 5937 |
5934 } else { | 5938 } else { |
5935 expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); | 5939 expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); |
5936 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 5940 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
5937 bool global_call = proxy != NULL && proxy->var()->IsUnallocated(); | 5941 bool global_call = proxy != NULL && proxy->var()->IsUnallocated(); |
5938 | 5942 |
| 5943 if (proxy != NULL && proxy->var()->is_possibly_eval()) { |
| 5944 return Bailout("possible direct call to eval"); |
| 5945 } |
| 5946 |
5939 if (global_call) { | 5947 if (global_call) { |
5940 Variable* var = proxy->var(); | 5948 Variable* var = proxy->var(); |
5941 bool known_global_function = false; | 5949 bool known_global_function = false; |
5942 // If there is a global property cell for the name at compile time and | 5950 // If there is a global property cell for the name at compile time and |
5943 // access check is not enabled we assume that the function will not change | 5951 // access check is not enabled we assume that the function will not change |
5944 // and generate optimized code for calling the function. | 5952 // and generate optimized code for calling the function. |
5945 LookupResult lookup(isolate()); | 5953 LookupResult lookup(isolate()); |
5946 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); | 5954 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); |
5947 if (type == kUseCell && | 5955 if (type == kUseCell && |
5948 !info()->global_object()->IsAccessCheckNeeded()) { | 5956 !info()->global_object()->IsAccessCheckNeeded()) { |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8231 } | 8239 } |
8232 } | 8240 } |
8233 | 8241 |
8234 #ifdef DEBUG | 8242 #ifdef DEBUG |
8235 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8243 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
8236 if (allocator_ != NULL) allocator_->Verify(); | 8244 if (allocator_ != NULL) allocator_->Verify(); |
8237 #endif | 8245 #endif |
8238 } | 8246 } |
8239 | 8247 |
8240 } } // namespace v8::internal | 8248 } } // namespace v8::internal |
OLD | NEW |