OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 if (!ast_context()->IsEffect()) Push(value); | 3221 if (!ast_context()->IsEffect()) Push(value); |
3222 current_block()->Goto(join); | 3222 current_block()->Goto(join); |
3223 | 3223 |
3224 set_current_block(if_false); | 3224 set_current_block(if_false); |
3225 } | 3225 } |
3226 } | 3226 } |
3227 | 3227 |
3228 // Finish up. Unconditionally deoptimize if we've handled all the maps we | 3228 // Finish up. Unconditionally deoptimize if we've handled all the maps we |
3229 // know about and do not want to handle ones we've never seen. Otherwise | 3229 // know about and do not want to handle ones we've never seen. Otherwise |
3230 // use a generic IC. | 3230 // use a generic IC. |
3231 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { | 3231 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { |
3232 current_block()->FinishExit(new HDeoptimize); | 3232 current_block()->FinishExit(new HDeoptimize); |
3233 } else { | 3233 } else { |
3234 HInstruction* instr = BuildStoreNamedGeneric(object, name, value); | 3234 HInstruction* instr = BuildStoreNamedGeneric(object, name, value); |
3235 instr->set_position(expr->position()); | 3235 instr->set_position(expr->position()); |
3236 AddInstruction(instr); | 3236 AddInstruction(instr); |
3237 | 3237 |
3238 if (join != NULL) { | 3238 if (join != NULL) { |
3239 if (!ast_context()->IsEffect()) Push(value); | 3239 if (!ast_context()->IsEffect()) Push(value); |
3240 current_block()->Goto(join); | 3240 current_block()->Goto(join); |
3241 } else { | 3241 } else { |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4440 } else { | 4440 } else { |
4441 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 4441 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
4442 bool global_call = (var != NULL) && var->is_global() && !var->is_this(); | 4442 bool global_call = (var != NULL) && var->is_global() && !var->is_this(); |
4443 | 4443 |
4444 if (!global_call) { | 4444 if (!global_call) { |
4445 ++argument_count; | 4445 ++argument_count; |
4446 VISIT_FOR_VALUE(expr->expression()); | 4446 VISIT_FOR_VALUE(expr->expression()); |
4447 } | 4447 } |
4448 | 4448 |
4449 if (global_call) { | 4449 if (global_call) { |
| 4450 bool known_global_function = false; |
4450 // If there is a global property cell for the name at compile time and | 4451 // If there is a global property cell for the name at compile time and |
4451 // access check is not enabled we assume that the function will not change | 4452 // access check is not enabled we assume that the function will not change |
4452 // and generate optimized code for calling the function. | 4453 // and generate optimized code for calling the function. |
4453 bool known_global_function = info()->has_global_object() && | 4454 if (info()->has_global_object() && |
4454 !info()->global_object()->IsAccessCheckNeeded() && | 4455 !info()->global_object()->IsAccessCheckNeeded()) { |
4455 expr->ComputeGlobalTarget(Handle<GlobalObject>(info()->global_object()
), | 4456 Handle<GlobalObject> global(info()->global_object()); |
4456 var->name()); | 4457 known_global_function = expr->ComputeGlobalTarget(global, var->name()); |
| 4458 } |
4457 if (known_global_function) { | 4459 if (known_global_function) { |
4458 // Push the global object instead of the global receiver because | 4460 // Push the global object instead of the global receiver because |
4459 // code generated by the full code generator expects it. | 4461 // code generated by the full code generator expects it. |
4460 HContext* context = new HContext; | 4462 HContext* context = new HContext; |
4461 HGlobalObject* global_object = new HGlobalObject(context); | 4463 HGlobalObject* global_object = new HGlobalObject(context); |
4462 AddInstruction(context); | 4464 AddInstruction(context); |
4463 PushAndAdd(global_object); | 4465 PushAndAdd(global_object); |
4464 VisitExpressions(expr->arguments()); | 4466 VisitExpressions(expr->arguments()); |
4465 CHECK_BAILOUT; | 4467 CHECK_BAILOUT; |
4466 | 4468 |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6045 } | 6047 } |
6046 } | 6048 } |
6047 | 6049 |
6048 #ifdef DEBUG | 6050 #ifdef DEBUG |
6049 if (graph_ != NULL) graph_->Verify(); | 6051 if (graph_ != NULL) graph_->Verify(); |
6050 if (allocator_ != NULL) allocator_->Verify(); | 6052 if (allocator_ != NULL) allocator_->Verify(); |
6051 #endif | 6053 #endif |
6052 } | 6054 } |
6053 | 6055 |
6054 } } // namespace v8::internal | 6056 } } // namespace v8::internal |
OLD | NEW |