| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 { Reference ref(this, node->catch_var()); | 2281 { Reference ref(this, node->catch_var()); |
| 2282 ASSERT(ref.is_slot()); | 2282 ASSERT(ref.is_slot()); |
| 2283 // Load the exception to the top of the stack. Here we make use of the | 2283 // Load the exception to the top of the stack. Here we make use of the |
| 2284 // convenient property that it doesn't matter whether a value is | 2284 // convenient property that it doesn't matter whether a value is |
| 2285 // immediately on top of or underneath a zero-sized reference. | 2285 // immediately on top of or underneath a zero-sized reference. |
| 2286 ref.SetValue(NOT_CONST_INIT); | 2286 ref.SetValue(NOT_CONST_INIT); |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 // Remove the exception from the stack. | 2289 // Remove the exception from the stack. |
| 2290 frame_->Drop(); | 2290 frame_->Drop(); |
| 2291 // Dropping a reference can leave the stack in an unspilled state. |
| 2292 frame_->SpillAll(); |
| 2291 | 2293 |
| 2292 VisitStatementsAndSpill(node->catch_block()->statements()); | 2294 VisitStatementsAndSpill(node->catch_block()->statements()); |
| 2293 if (has_valid_frame()) { | 2295 if (has_valid_frame()) { |
| 2294 exit.Jump(); | 2296 exit.Jump(); |
| 2295 } | 2297 } |
| 2296 | 2298 |
| 2297 | 2299 |
| 2298 // --- Try block --- | 2300 // --- Try block --- |
| 2299 try_block.Bind(); | 2301 try_block.Bind(); |
| 2300 | 2302 |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 LoadAndSpill(node->value()); | 3071 LoadAndSpill(node->value()); |
| 3070 GenericBinaryOperation(node->binary_op(), node->type()); | 3072 GenericBinaryOperation(node->binary_op(), node->type()); |
| 3071 } | 3073 } |
| 3072 } | 3074 } |
| 3073 | 3075 |
| 3074 Variable* var = node->target()->AsVariableProxy()->AsVariable(); | 3076 Variable* var = node->target()->AsVariableProxy()->AsVariable(); |
| 3075 if (var != NULL && | 3077 if (var != NULL && |
| 3076 var->mode() == Variable::CONST && | 3078 var->mode() == Variable::CONST && |
| 3077 node->op() != Token::INIT_VAR && node->op() != Token::INIT_CONST) { | 3079 node->op() != Token::INIT_VAR && node->op() != Token::INIT_CONST) { |
| 3078 // Assignment ignored - leave the value on the stack. | 3080 // Assignment ignored - leave the value on the stack. |
| 3079 } else { | 3081 } else { |
| 3080 CodeForSourcePosition(node->position()); | 3082 CodeForSourcePosition(node->position()); |
| 3081 if (node->op() == Token::INIT_CONST) { | 3083 if (node->op() == Token::INIT_CONST) { |
| 3082 // Dynamic constant initializations must use the function context | 3084 // Dynamic constant initializations must use the function context |
| 3083 // and initialize the actual constant declared. Dynamic variable | 3085 // and initialize the actual constant declared. Dynamic variable |
| 3084 // initializations are simply assignments and use SetValue. | 3086 // initializations are simply assignments and use SetValue. |
| 3085 target.SetValue(CONST_INIT); | 3087 target.SetValue(CONST_INIT); |
| 3086 } else { | 3088 } else { |
| 3087 target.SetValue(NOT_CONST_INIT); | 3089 target.SetValue(NOT_CONST_INIT); |
| 3088 } | 3090 } |
| 3089 } | 3091 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3220 frame_->SpillAll(); | 3222 frame_->SpillAll(); |
| 3221 ref.GetValueAndSpill(NOT_INSIDE_TYPEOF); | 3223 ref.GetValueAndSpill(NOT_INSIDE_TYPEOF); |
| 3222 | 3224 |
| 3223 // Pass receiver to called function. | 3225 // Pass receiver to called function. |
| 3224 // The reference's size is non-negative. | 3226 // The reference's size is non-negative. |
| 3225 frame_->EmitPush(frame_->ElementAt(ref.size())); | 3227 frame_->EmitPush(frame_->ElementAt(ref.size())); |
| 3226 | 3228 |
| 3227 // Call the function. | 3229 // Call the function. |
| 3228 CallWithArguments(args, node->position()); | 3230 CallWithArguments(args, node->position()); |
| 3229 } | 3231 } |
| 3232 // Needed because of the Reference destructor in the else case. |
| 3233 // Does nothing in the then case. |
| 3234 frame_->SpillAll(); |
| 3230 | 3235 |
| 3231 } else { | 3236 } else { |
| 3232 // ---------------------------------- | 3237 // ---------------------------------- |
| 3233 // JavaScript example: 'foo(1, 2, 3)' // foo is not global | 3238 // JavaScript example: 'foo(1, 2, 3)' // foo is not global |
| 3234 // ---------------------------------- | 3239 // ---------------------------------- |
| 3235 | 3240 |
| 3236 // Load the function. | 3241 // Load the function. |
| 3237 LoadAndSpill(function); | 3242 LoadAndSpill(function); |
| 3238 | 3243 |
| 3239 // Pass the global proxy as the receiver. | 3244 // Pass the global proxy as the receiver. |
| (...skipping 2704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5944 | 5949 |
| 5945 // Slow-case: Go through the JavaScript implementation. | 5950 // Slow-case: Go through the JavaScript implementation. |
| 5946 __ bind(&slow); | 5951 __ bind(&slow); |
| 5947 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5952 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5948 } | 5953 } |
| 5949 | 5954 |
| 5950 | 5955 |
| 5951 #undef __ | 5956 #undef __ |
| 5952 | 5957 |
| 5953 } } // namespace v8::internal | 5958 } } // namespace v8::internal |
| OLD | NEW |