diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2012-04-17 11:03:39 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-26 08:55:55 +0200 |
commit | 227e72d1bba70d518639996aab4146b060507cd6 (patch) | |
tree | 723564e760e94a7d205a3d3300c44192e1d2f2e1 /src/3rdparty/v8/src/rewriter.cc | |
parent | 5b1fcb16da41f711f27f2e8ff84de8b70a30b645 (diff) |
Updated V8 from git://github.com/v8/v8.git to 57f8959fb264354ba1a2e5118db512f588917061
Update V8 source to version 3.10.1.
* Added optimizations and stability improvements on all platforms.
* Various performance improvements.
* Cleanup ScopeInfo and SerializedScopeInfo.
* Introduce extended mode.
* Implemented performance improvements to the incremental garbage
collector.
* Fixed handling of arrays in DefineOwnProperty. (issue 1756)
* Fixed GCC 4.7 warnings.
* Performance improvements for large Smi-only arrays.
* Reduce the space used by the stack for the profiling thread.
* Reduced memory use immediately after starting V8.
* Fixed VFP detection through compiler defines. (issue 1996)
* Remove static initializers in v8. (issue 1859)
* Optimized boot-up memory use.
* Optimized regular expressions.
Change-Id: I2dad3092612de279179950dae4dd43daf0463a9f
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/rewriter.cc')
-rw-r--r-- | src/3rdparty/v8/src/rewriter.cc | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/src/3rdparty/v8/src/rewriter.cc b/src/3rdparty/v8/src/rewriter.cc index 3d4c2dc..e58ddb4 100644 --- a/src/3rdparty/v8/src/rewriter.cc +++ b/src/3rdparty/v8/src/rewriter.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -42,12 +42,18 @@ class Processor: public AstVisitor { : result_(result), result_assigned_(false), is_set_(false), - in_try_(false) { - } + in_try_(false), + factory_(isolate()) { } + + virtual ~Processor() { } void Process(ZoneList<Statement*>* statements); bool result_assigned() const { return result_assigned_; } + AstNodeFactory<AstNullVisitor>* factory() { + return &factory_; + } + private: Variable* result_; @@ -64,15 +70,13 @@ class Processor: public AstVisitor { bool is_set_; bool in_try_; + AstNodeFactory<AstNullVisitor> factory_; + Expression* SetResult(Expression* value) { result_assigned_ = true; - Zone* zone = isolate()->zone(); - VariableProxy* result_proxy = new(zone) VariableProxy(isolate(), result_); - return new(zone) Assignment(isolate(), - Token::ASSIGN, - result_proxy, - value, - RelocInfo::kNoPosition); + VariableProxy* result_proxy = factory()->NewVariableProxy(result_); + return factory()->NewAssignment( + Token::ASSIGN, result_proxy, value, RelocInfo::kNoPosition); } // Node visitors. @@ -107,7 +111,7 @@ void Processor::VisitBlock(Block* node) { void Processor::VisitExpressionStatement(ExpressionStatement* node) { // Rewrite : <x>; -> .result = <x>; - if (!is_set_) { + if (!is_set_ && !node->expression()->IsThrow()) { node->set_expression(SetResult(node->expression())); if (!in_try_) is_set_ = true; } @@ -205,7 +209,15 @@ void Processor::VisitWithStatement(WithStatement* node) { // Do nothing: -void Processor::VisitDeclaration(Declaration* node) {} +void Processor::VisitVariableDeclaration(VariableDeclaration* node) {} +void Processor::VisitFunctionDeclaration(FunctionDeclaration* node) {} +void Processor::VisitModuleDeclaration(ModuleDeclaration* node) {} +void Processor::VisitImportDeclaration(ImportDeclaration* node) {} +void Processor::VisitExportDeclaration(ExportDeclaration* node) {} +void Processor::VisitModuleLiteral(ModuleLiteral* node) {} +void Processor::VisitModuleVariable(ModuleVariable* node) {} +void Processor::VisitModulePath(ModulePath* node) {} +void Processor::VisitModuleUrl(ModuleUrl* node) {} void Processor::VisitEmptyStatement(EmptyStatement* node) {} void Processor::VisitReturnStatement(ReturnStatement* node) {} void Processor::VisitDebuggerStatement(DebuggerStatement* node) {} @@ -236,10 +248,21 @@ bool Rewriter::Rewrite(CompilationInfo* info) { if (processor.HasStackOverflow()) return false; if (processor.result_assigned()) { - Isolate* isolate = info->isolate(); - Zone* zone = isolate->zone(); - VariableProxy* result_proxy = new(zone) VariableProxy(isolate, result); - body->Add(new(zone) ReturnStatement(result_proxy)); + ASSERT(function->end_position() != RelocInfo::kNoPosition); + // Set the position of the assignment statement one character past the + // source code, such that it definitely is not in the source code range + // of an immediate inner scope. For example in + // eval('with ({x:1}) x = 1'); + // the end position of the function generated for executing the eval code + // coincides with the end of the with scope which is the position of '1'. + int position = function->end_position(); + VariableProxy* result_proxy = processor.factory()->NewVariableProxy( + result->name(), false, position); + result_proxy->BindTo(result); + Statement* result_statement = + processor.factory()->NewReturnStatement(result_proxy); + result_statement->set_statement_pos(position); + body->Add(result_statement); } } |