Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/parser.cc

Issue 8343054: Make eval consider anything on the form eval(args...) a potential direct cal (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 break; 2925 break;
2926 } 2926 }
2927 2927
2928 case Token::LPAREN: { 2928 case Token::LPAREN: {
2929 int pos = scanner().location().beg_pos; 2929 int pos = scanner().location().beg_pos;
2930 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); 2930 ZoneList<Expression*>* args = ParseArguments(CHECK_OK);
2931 2931
2932 // Keep track of eval() calls since they disable all local variable 2932 // Keep track of eval() calls since they disable all local variable
2933 // optimizations. 2933 // optimizations.
2934 // The calls that need special treatment are the 2934 // The calls that need special treatment are the
2935 // direct (i.e. not aliased) eval calls. These calls are all of the 2935 // direct eval calls. These calls are all of the form eval(...), with
2936 // form eval(...) with no explicit receiver object where eval is not 2936 // no explicit receiver.
2937 // declared in the current scope chain.
2938 // These calls are marked as potentially direct eval calls. Whether 2937 // These calls are marked as potentially direct eval calls. Whether
2939 // they are actually direct calls to eval is determined at run time. 2938 // they are actually direct calls to eval is determined at run time.
2940 // TODO(994): In ES5, it doesn't matter if the "eval" var is declared
2941 // in the local scope chain. It only matters that it's called "eval",
2942 // is called without a receiver and it refers to the original eval
2943 // function.
2944 VariableProxy* callee = result->AsVariableProxy(); 2939 VariableProxy* callee = result->AsVariableProxy();
2945 if (callee != NULL && 2940 if (callee != NULL &&
2946 callee->IsVariable(isolate()->factory()->eval_symbol())) { 2941 callee->IsVariable(isolate()->factory()->eval_symbol())) {
2947 Handle<String> name = callee->name(); 2942 top_scope_->DeclarationScope()->RecordEvalCall();
2948 Variable* var = top_scope_->Lookup(name);
2949 if (var == NULL) {
2950 top_scope_->DeclarationScope()->RecordEvalCall();
2951 }
2952 } 2943 }
2953 result = NewCall(result, args, pos); 2944 result = NewCall(result, args, pos);
2954 break; 2945 break;
2955 } 2946 }
2956 2947
2957 case Token::PERIOD: { 2948 case Token::PERIOD: {
2958 Consume(Token::PERIOD); 2949 Consume(Token::PERIOD);
2959 int pos = scanner().location().beg_pos; 2950 int pos = scanner().location().beg_pos;
2960 Handle<String> name = ParseIdentifierName(CHECK_OK); 2951 Handle<String> name = ParseIdentifierName(CHECK_OK);
2961 result = new(zone()) Property(isolate(), 2952 result = new(zone()) Property(isolate(),
(...skipping 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 result = parser.ParseProgram(source, 5410 result = parser.ParseProgram(source,
5420 info->is_global(), 5411 info->is_global(),
5421 info->strict_mode_flag()); 5412 info->strict_mode_flag());
5422 } 5413 }
5423 } 5414 }
5424 info->SetFunction(result); 5415 info->SetFunction(result);
5425 return (result != NULL); 5416 return (result != NULL);
5426 } 5417 }
5427 5418
5428 } } // namespace v8::internal 5419 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698