| 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 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 case Token::LBRACK: { | 2993 case Token::LBRACK: { |
| 2994 Consume(Token::LBRACK); | 2994 Consume(Token::LBRACK); |
| 2995 int pos = scanner().location().beg_pos; | 2995 int pos = scanner().location().beg_pos; |
| 2996 Expression* index = ParseExpression(true, CHECK_OK); | 2996 Expression* index = ParseExpression(true, CHECK_OK); |
| 2997 result = new(zone()) Property(isolate(), result, index, pos); | 2997 result = new(zone()) Property(isolate(), result, index, pos); |
| 2998 Expect(Token::RBRACK, CHECK_OK); | 2998 Expect(Token::RBRACK, CHECK_OK); |
| 2999 break; | 2999 break; |
| 3000 } | 3000 } |
| 3001 | 3001 |
| 3002 case Token::LPAREN: { | 3002 case Token::LPAREN: { |
| 3003 int pos = scanner().location().beg_pos; | 3003 int pos; |
| 3004 if (scanner().current_token() == Token::IDENTIFIER) { |
| 3005 // For call of an identifier we want to report position of |
| 3006 // the identifier as position of the call in the stack trace. |
| 3007 pos = scanner().location().beg_pos; |
| 3008 } else { |
| 3009 // For other kinds of calls we record position of the parenthesis as |
| 3010 // position of the call. Note that this is extremely important for |
| 3011 // expressions of the form function(){...}() for which call position |
| 3012 // should not point to the closing brace otherwise it will intersect |
| 3013 // with positions recorded for function literal and confuse debugger. |
| 3014 pos = scanner().peek_location().beg_pos; |
| 3015 } |
| 3004 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); | 3016 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); |
| 3005 | 3017 |
| 3006 // Keep track of eval() calls since they disable all local variable | 3018 // Keep track of eval() calls since they disable all local variable |
| 3007 // optimizations. | 3019 // optimizations. |
| 3008 // The calls that need special treatment are the | 3020 // The calls that need special treatment are the |
| 3009 // direct eval calls. These calls are all of the form eval(...), with | 3021 // direct eval calls. These calls are all of the form eval(...), with |
| 3010 // no explicit receiver. | 3022 // no explicit receiver. |
| 3011 // These calls are marked as potentially direct eval calls. Whether | 3023 // These calls are marked as potentially direct eval calls. Whether |
| 3012 // they are actually direct calls to eval is determined at run time. | 3024 // they are actually direct calls to eval is determined at run time. |
| 3013 VariableProxy* callee = result->AsVariableProxy(); | 3025 VariableProxy* callee = result->AsVariableProxy(); |
| (...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5656 ASSERT(info->isolate()->has_pending_exception()); | 5668 ASSERT(info->isolate()->has_pending_exception()); |
| 5657 } else { | 5669 } else { |
| 5658 result = parser.ParseProgram(info); | 5670 result = parser.ParseProgram(info); |
| 5659 } | 5671 } |
| 5660 } | 5672 } |
| 5661 info->SetFunction(result); | 5673 info->SetFunction(result); |
| 5662 return (result != NULL); | 5674 return (result != NULL); |
| 5663 } | 5675 } |
| 5664 | 5676 |
| 5665 } } // namespace v8::internal | 5677 } } // namespace v8::internal |
| OLD | NEW |