OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3920 frame_->PushElementAt(target.size() - 1); | 3920 frame_->PushElementAt(target.size() - 1); |
3921 Result ignored = frame_->CallRuntime(Runtime::kToSlowProperties, 1); | 3921 Result ignored = frame_->CallRuntime(Runtime::kToSlowProperties, 1); |
3922 } | 3922 } |
3923 if (node->op() == Token::ASSIGN || | 3923 if (node->op() == Token::ASSIGN || |
3924 node->op() == Token::INIT_VAR || | 3924 node->op() == Token::INIT_VAR || |
3925 node->op() == Token::INIT_CONST) { | 3925 node->op() == Token::INIT_CONST) { |
3926 Load(node->value()); | 3926 Load(node->value()); |
3927 | 3927 |
3928 } else { | 3928 } else { |
3929 Literal* literal = node->value()->AsLiteral(); | 3929 Literal* literal = node->value()->AsLiteral(); |
| 3930 bool overwrite_value = |
| 3931 (node->value()->AsBinaryOperation() != NULL && |
| 3932 node->value()->AsBinaryOperation()->ResultOverwriteAllowed()); |
3930 Variable* right_var = node->value()->AsVariableProxy()->AsVariable(); | 3933 Variable* right_var = node->value()->AsVariableProxy()->AsVariable(); |
3931 // There are two cases where the target is not read in the right hand | 3934 // There are two cases where the target is not read in the right hand |
3932 // side, that are easy to test for: the right hand side is a literal, | 3935 // side, that are easy to test for: the right hand side is a literal, |
3933 // or the right hand side is a different variable. TakeValue invalidates | 3936 // or the right hand side is a different variable. TakeValue invalidates |
3934 // the target, with an implicit promise that it will be written to again | 3937 // the target, with an implicit promise that it will be written to again |
3935 // before it is read. | 3938 // before it is read. |
3936 if (literal != NULL || (right_var != NULL && right_var != var)) { | 3939 if (literal != NULL || (right_var != NULL && right_var != var)) { |
3937 target.TakeValue(NOT_INSIDE_TYPEOF); | 3940 target.TakeValue(NOT_INSIDE_TYPEOF); |
3938 } else { | 3941 } else { |
3939 target.GetValue(NOT_INSIDE_TYPEOF); | 3942 target.GetValue(NOT_INSIDE_TYPEOF); |
3940 } | 3943 } |
3941 Load(node->value()); | 3944 Load(node->value()); |
3942 GenericBinaryOperation(node->binary_op(), node->type()); | 3945 GenericBinaryOperation(node->binary_op(), |
| 3946 node->type(), |
| 3947 overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE); |
3943 } | 3948 } |
3944 | 3949 |
3945 if (var != NULL && | 3950 if (var != NULL && |
3946 var->mode() == Variable::CONST && | 3951 var->mode() == Variable::CONST && |
3947 node->op() != Token::INIT_VAR && node->op() != Token::INIT_CONST) { | 3952 node->op() != Token::INIT_VAR && node->op() != Token::INIT_CONST) { |
3948 // Assignment ignored - leave the value on the stack. | 3953 // Assignment ignored - leave the value on the stack. |
3949 } else { | 3954 } else { |
3950 CodeForSourcePosition(node->position()); | 3955 CodeForSourcePosition(node->position()); |
3951 if (node->op() == Token::INIT_CONST) { | 3956 if (node->op() == Token::INIT_CONST) { |
3952 // Dynamic constant initializations must use the function context | 3957 // Dynamic constant initializations must use the function context |
(...skipping 3148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7101 | 7106 |
7102 // Slow-case: Go through the JavaScript implementation. | 7107 // Slow-case: Go through the JavaScript implementation. |
7103 __ bind(&slow); | 7108 __ bind(&slow); |
7104 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7109 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
7105 } | 7110 } |
7106 | 7111 |
7107 | 7112 |
7108 #undef __ | 7113 #undef __ |
7109 | 7114 |
7110 } } // namespace v8::internal | 7115 } } // namespace v8::internal |
OLD | NEW |