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

Side by Side Diff: src/parser.cc

Issue 7830036: Optimize isFinite and isNaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the change general by moving putting it in the NUMBER_IS_FINITE macro. Created 9 years, 3 months 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/mksnapshot.cc ('k') | src/profile-generator.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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "ast-inl.h" 31 #include "ast-inl.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "char-predicates-inl.h"
34 #include "codegen.h" 33 #include "codegen.h"
35 #include "compiler.h" 34 #include "compiler.h"
36 #include "func-name-inferrer.h" 35 #include "func-name-inferrer.h"
37 #include "messages.h" 36 #include "messages.h"
38 #include "parser.h" 37 #include "parser.h"
39 #include "platform.h" 38 #include "platform.h"
40 #include "preparser.h" 39 #include "preparser.h"
41 #include "runtime.h" 40 #include "runtime.h"
42 #include "scopeinfo.h" 41 #include "scopeinfo.h"
43 #include "string-stream.h" 42 #include "string-stream.h"
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 } 1552 }
1554 1553
1555 1554
1556 Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) { 1555 Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) {
1557 // Construct block expecting 16 statements. 1556 // Construct block expecting 16 statements.
1558 Block* body = new(zone()) Block(isolate(), labels, 16, false); 1557 Block* body = new(zone()) Block(isolate(), labels, 16, false);
1559 Scope* saved_scope = top_scope_; 1558 Scope* saved_scope = top_scope_;
1560 Scope* block_scope = NewScope(top_scope_, 1559 Scope* block_scope = NewScope(top_scope_,
1561 Scope::BLOCK_SCOPE, 1560 Scope::BLOCK_SCOPE,
1562 inside_with()); 1561 inside_with());
1562 body->set_block_scope(block_scope);
1563 block_scope->DeclareLocal(isolate()->factory()->block_scope_symbol(),
1564 Variable::VAR);
1563 if (top_scope_->is_strict_mode()) { 1565 if (top_scope_->is_strict_mode()) {
1564 block_scope->EnableStrictMode(); 1566 block_scope->EnableStrictMode();
1565 } 1567 }
1566 top_scope_ = block_scope; 1568 top_scope_ = block_scope;
1567 1569
1568 // Parse the statements and collect escaping labels. 1570 // Parse the statements and collect escaping labels.
1569 TargetCollector collector; 1571 TargetCollector collector;
1570 Target target(&this->target_stack_, &collector); 1572 Target target(&this->target_stack_, &collector);
1571 Expect(Token::LBRACE, CHECK_OK); 1573 Expect(Token::LBRACE, CHECK_OK);
1572 { 1574 {
1573 Target target_body(&this->target_stack_, body); 1575 Target target_body(&this->target_stack_, body);
1574 InitializationBlockFinder block_finder(top_scope_, target_stack_); 1576 InitializationBlockFinder block_finder(top_scope_, target_stack_);
1575 1577
1576 while (peek() != Token::RBRACE) { 1578 while (peek() != Token::RBRACE) {
1577 Statement* stat = ParseSourceElement(NULL, CHECK_OK); 1579 Statement* stat = ParseSourceElement(NULL, CHECK_OK);
1578 if (stat && !stat->IsEmpty()) { 1580 if (stat && !stat->IsEmpty()) {
1579 body->AddStatement(stat); 1581 body->AddStatement(stat);
1580 block_finder.Update(stat); 1582 block_finder.Update(stat);
1581 } 1583 }
1582 } 1584 }
1583 } 1585 }
1584 Expect(Token::RBRACE, CHECK_OK); 1586 Expect(Token::RBRACE, CHECK_OK);
1587
1588 // Create exit block.
1589 Block* exit = new(zone()) Block(isolate(), NULL, 1, false);
1590 exit->AddStatement(new(zone()) ExitContextStatement());
1591
1592 // Create a try-finally statement.
1593 TryFinallyStatement* try_finally =
1594 new(zone()) TryFinallyStatement(body, exit);
1595 try_finally->set_escaping_targets(collector.targets());
1585 top_scope_ = saved_scope; 1596 top_scope_ = saved_scope;
1586 1597
1587 block_scope = block_scope->FinalizeBlockScope(); 1598 // Create a result block.
1588 body->set_block_scope(block_scope); 1599 Block* result = new(zone()) Block(isolate(), NULL, 1, false);
1589 1600 result->AddStatement(try_finally);
1590 if (block_scope != NULL) { 1601 return result;
1591 // Create exit block.
1592 Block* exit = new(zone()) Block(isolate(), NULL, 1, false);
1593 exit->AddStatement(new(zone()) ExitContextStatement());
1594
1595 // Create a try-finally statement.
1596 TryFinallyStatement* try_finally =
1597 new(zone()) TryFinallyStatement(body, exit);
1598 try_finally->set_escaping_targets(collector.targets());
1599
1600 // Create a result block.
1601 Block* result = new(zone()) Block(isolate(), NULL, 1, false);
1602 result->AddStatement(try_finally);
1603 return result;
1604 } else {
1605 return body;
1606 }
1607 } 1602 }
1608 1603
1609 1604
1610 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context, 1605 Block* Parser::ParseVariableStatement(VariableDeclarationContext var_context,
1611 bool* ok) { 1606 bool* ok) {
1612 // VariableStatement :: 1607 // VariableStatement ::
1613 // VariableDeclarations ';' 1608 // VariableDeclarations ';'
1614 1609
1615 Handle<String> ignore; 1610 Handle<String> ignore;
1616 Block* result = ParseVariableDeclarations(var_context, 1611 Block* result = ParseVariableDeclarations(var_context,
(...skipping 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 result = parser.ParseProgram(source, 5236 result = parser.ParseProgram(source,
5242 info->is_global(), 5237 info->is_global(),
5243 info->StrictMode()); 5238 info->StrictMode());
5244 } 5239 }
5245 } 5240 }
5246 info->SetFunction(result); 5241 info->SetFunction(result);
5247 return (result != NULL); 5242 return (result != NULL);
5248 } 5243 }
5249 5244
5250 } } // namespace v8::internal 5245 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698