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 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3368 VariableProxy* proxy = target->AsVariableProxy(); | 3368 VariableProxy* proxy = target->AsVariableProxy(); |
3369 Variable* var = proxy->AsVariable(); | 3369 Variable* var = proxy->AsVariable(); |
3370 Property* prop = target->AsProperty(); | 3370 Property* prop = target->AsProperty(); |
3371 ASSERT(var == NULL || prop == NULL); | 3371 ASSERT(var == NULL || prop == NULL); |
3372 | 3372 |
3373 // We have a second position recorded in the FullCodeGenerator to have | 3373 // We have a second position recorded in the FullCodeGenerator to have |
3374 // type feedback for the binary operation. | 3374 // type feedback for the binary operation. |
3375 BinaryOperation* operation = expr->binary_operation(); | 3375 BinaryOperation* operation = expr->binary_operation(); |
3376 | 3376 |
3377 if (var != NULL) { | 3377 if (var != NULL) { |
3378 if (!var->is_global() && !var->IsStackAllocated()) { | |
3379 BAILOUT("non-stack/non-global in compound assignment"); | |
3380 } | |
3381 | |
3382 VISIT_FOR_VALUE(operation); | 3378 VISIT_FOR_VALUE(operation); |
3383 | 3379 |
3384 if (var->is_global()) { | 3380 if (var->is_global()) { |
3385 HandleGlobalVariableAssignment(var, | 3381 HandleGlobalVariableAssignment(var, |
3386 Top(), | 3382 Top(), |
3387 expr->position(), | 3383 expr->position(), |
3388 expr->AssignmentId()); | 3384 expr->AssignmentId()); |
3385 } else if (var->IsStackAllocated()) { | |
3386 Bind(var, Top()); | |
3387 } else if (var->IsContextSlot()) { | |
3388 HValue* context = BuildContextChainWalk(var); | |
3389 int index = var->AsSlot()->index(); | |
3390 HStoreContextSlot* instr = new HStoreContextSlot(context, index, Top()); | |
3391 AddInstruction(instr); | |
3392 if (instr->HasSideEffects()) AddSimulate(expr->AssignmentId()); | |
3389 } else { | 3393 } else { |
3390 Bind(var, Top()); | 3394 BAILOUT("compound assignment to lookup slot"); |
3391 } | 3395 } |
3392 ast_context()->ReturnValue(Pop()); | 3396 ast_context()->ReturnValue(Pop()); |
3393 | 3397 |
3394 } else if (prop != NULL) { | 3398 } else if (prop != NULL) { |
3395 prop->RecordTypeFeedback(oracle()); | 3399 prop->RecordTypeFeedback(oracle()); |
3396 | 3400 |
3397 if (prop->key()->IsPropertyName()) { | 3401 if (prop->key()->IsPropertyName()) { |
3398 // Named property. | 3402 // Named property. |
3399 VISIT_FOR_VALUE(prop->obj()); | 3403 VISIT_FOR_VALUE(prop->obj()); |
3400 HValue* obj = Top(); | 3404 HValue* obj = Top(); |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4697 void HGraphBuilder::VisitCountOperation(CountOperation* expr) { | 4701 void HGraphBuilder::VisitCountOperation(CountOperation* expr) { |
4698 IncrementOperation* increment = expr->increment(); | 4702 IncrementOperation* increment = expr->increment(); |
4699 Expression* target = increment->expression(); | 4703 Expression* target = increment->expression(); |
4700 VariableProxy* proxy = target->AsVariableProxy(); | 4704 VariableProxy* proxy = target->AsVariableProxy(); |
4701 Variable* var = proxy->AsVariable(); | 4705 Variable* var = proxy->AsVariable(); |
4702 Property* prop = target->AsProperty(); | 4706 Property* prop = target->AsProperty(); |
4703 ASSERT(var == NULL || prop == NULL); | 4707 ASSERT(var == NULL || prop == NULL); |
4704 bool inc = expr->op() == Token::INC; | 4708 bool inc = expr->op() == Token::INC; |
4705 | 4709 |
4706 if (var != NULL) { | 4710 if (var != NULL) { |
4707 if (!var->is_global() && !var->IsStackAllocated()) { | |
4708 BAILOUT("non-stack/non-global variable in count operation"); | |
4709 } | |
4710 | |
4711 VISIT_FOR_VALUE(target); | 4711 VISIT_FOR_VALUE(target); |
4712 | 4712 |
4713 // Match the full code generator stack by simulating an extra stack | 4713 // Match the full code generator stack by simulating an extra stack |
4714 // element for postfix operations in a non-effect context. | 4714 // element for postfix operations in a non-effect context. |
4715 bool has_extra = expr->is_postfix() && !ast_context()->IsEffect(); | 4715 bool has_extra = expr->is_postfix() && !ast_context()->IsEffect(); |
4716 HValue* before = has_extra ? Top() : Pop(); | 4716 HValue* before = has_extra ? Top() : Pop(); |
4717 HInstruction* after = BuildIncrement(before, inc); | 4717 HInstruction* after = BuildIncrement(before, inc); |
4718 AddInstruction(after); | 4718 AddInstruction(after); |
4719 Push(after); | 4719 Push(after); |
4720 | 4720 |
4721 if (var->is_global()) { | 4721 if (var->is_global()) { |
4722 HandleGlobalVariableAssignment(var, | 4722 HandleGlobalVariableAssignment(var, |
4723 after, | 4723 after, |
4724 expr->position(), | 4724 expr->position(), |
4725 expr->AssignmentId()); | 4725 expr->AssignmentId()); |
4726 } else if (var->IsStackAllocated()) { | |
4727 Bind(var, after); | |
4728 } else if (var->IsContextSlot()) { | |
4729 HValue* context = BuildContextChainWalk(var); | |
4730 int index = var->AsSlot()->index(); | |
4731 HStoreContextSlot* instr = new HStoreContextSlot(context, index, after); | |
4732 AddInstruction(instr); | |
4733 if (instr->HasSideEffects()) AddSimulate(expr->AssignmentId()); | |
4726 } else { | 4734 } else { |
4727 ASSERT(var->IsStackAllocated()); | 4735 BAILOUT("non-stack/non-global variable in count operation"); |
Kevin Millikin (Chromium)
2011/02/15 16:34:58
"non-stack/non-global" ==> "lookup"
| |
4728 Bind(var, after); | |
4729 } | 4736 } |
4730 Drop(has_extra ? 2 : 1); | 4737 Drop(has_extra ? 2 : 1); |
4731 ast_context()->ReturnValue(expr->is_postfix() ? before : after); | 4738 ast_context()->ReturnValue(expr->is_postfix() ? before : after); |
4732 | 4739 |
4733 } else if (prop != NULL) { | 4740 } else if (prop != NULL) { |
4734 prop->RecordTypeFeedback(oracle()); | 4741 prop->RecordTypeFeedback(oracle()); |
4735 | 4742 |
4736 if (prop->key()->IsPropertyName()) { | 4743 if (prop->key()->IsPropertyName()) { |
4737 // Named property. | 4744 // Named property. |
4738 | 4745 |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5972 } | 5979 } |
5973 } | 5980 } |
5974 | 5981 |
5975 #ifdef DEBUG | 5982 #ifdef DEBUG |
5976 if (graph_ != NULL) graph_->Verify(); | 5983 if (graph_ != NULL) graph_->Verify(); |
5977 if (allocator_ != NULL) allocator_->Verify(); | 5984 if (allocator_ != NULL) allocator_->Verify(); |
5978 #endif | 5985 #endif |
5979 } | 5986 } |
5980 | 5987 |
5981 } } // namespace v8::internal | 5988 } } // namespace v8::internal |
OLD | NEW |