HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Ice Cream Sandwich
|
4.0.2_r1
下载
查看原文件
收藏
根目录
external
v8
src
full-codegen.cc
// Copyright 2011 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: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "v8.h" #include "codegen.h" #include "compiler.h" #include "debug.h" #include "full-codegen.h" #include "liveedit.h" #include "macro-assembler.h" #include "prettyprinter.h" #include "scopes.h" #include "stub-cache.h" namespace v8 { namespace internal { void BreakableStatementChecker::Check(Statement* stmt) { Visit(stmt); } void BreakableStatementChecker::Check(Expression* expr) { Visit(expr); } void BreakableStatementChecker::VisitDeclaration(Declaration* decl) { } void BreakableStatementChecker::VisitBlock(Block* stmt) { } void BreakableStatementChecker::VisitExpressionStatement( ExpressionStatement* stmt) { // Check if expression is breakable. Visit(stmt->expression()); } void BreakableStatementChecker::VisitEmptyStatement(EmptyStatement* stmt) { } void BreakableStatementChecker::VisitIfStatement(IfStatement* stmt) { // If the condition is breakable the if statement is breakable. Visit(stmt->condition()); } void BreakableStatementChecker::VisitContinueStatement( ContinueStatement* stmt) { } void BreakableStatementChecker::VisitBreakStatement(BreakStatement* stmt) { } void BreakableStatementChecker::VisitReturnStatement(ReturnStatement* stmt) { // Return is breakable if the expression is. Visit(stmt->expression()); } void BreakableStatementChecker::VisitWithEnterStatement( WithEnterStatement* stmt) { Visit(stmt->expression()); } void BreakableStatementChecker::VisitWithExitStatement( WithExitStatement* stmt) { } void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement* stmt) { // Switch statements breakable if the tag expression is. Visit(stmt->tag()); } void BreakableStatementChecker::VisitDoWhileStatement(DoWhileStatement* stmt) { // Mark do while as breakable to avoid adding a break slot in front of it. is_breakable_ = true; } void BreakableStatementChecker::VisitWhileStatement(WhileStatement* stmt) { // Mark while statements breakable if the condition expression is. Visit(stmt->cond()); } void BreakableStatementChecker::VisitForStatement(ForStatement* stmt) { // Mark for statements breakable if the condition expression is. if (stmt->cond() != NULL) { Visit(stmt->cond()); } } void BreakableStatementChecker::VisitForInStatement(ForInStatement* stmt) { // Mark for in statements breakable if the enumerable expression is. Visit(stmt->enumerable()); } void BreakableStatementChecker::VisitTryCatchStatement( TryCatchStatement* stmt) { // Mark try catch as breakable to avoid adding a break slot in front of it. is_breakable_ = true; } void BreakableStatementChecker::VisitTryFinallyStatement( TryFinallyStatement* stmt) { // Mark try finally as breakable to avoid adding a break slot in front of it. is_breakable_ = true; } void BreakableStatementChecker::VisitDebuggerStatement( DebuggerStatement* stmt) { // The debugger statement is breakable. is_breakable_ = true; } void BreakableStatementChecker::VisitFunctionLiteral(FunctionLiteral* expr) { } void BreakableStatementChecker::VisitSharedFunctionInfoLiteral( SharedFunctionInfoLiteral* expr) { } void BreakableStatementChecker::VisitConditional(Conditional* expr) { } void BreakableStatementChecker::VisitVariableProxy(VariableProxy* expr) { } void BreakableStatementChecker::VisitLiteral(Literal* expr) { } void BreakableStatementChecker::VisitRegExpLiteral(RegExpLiteral* expr) { } void BreakableStatementChecker::VisitObjectLiteral(ObjectLiteral* expr) { } void BreakableStatementChecker::VisitArrayLiteral(ArrayLiteral* expr) { } void BreakableStatementChecker::VisitCatchExtensionObject( CatchExtensionObject* expr) { } void BreakableStatementChecker::VisitAssignment(Assignment* expr) { // If assigning to a property (including a global property) the assignment is // breakable. Variable* var = expr->target()->AsVariableProxy()->AsVariable(); Property* prop = expr->target()->AsProperty(); if (prop != NULL || (var != NULL && var->is_global())) { is_breakable_ = true; return; } // Otherwise the assignment is breakable if the assigned value is. Visit(expr->value()); } void BreakableStatementChecker::VisitThrow(Throw* expr) { // Throw is breakable if the expression is. Visit(expr->exception()); } void BreakableStatementChecker::VisitProperty(Property* expr) { // Property load is breakable. is_breakable_ = true; } void BreakableStatementChecker::VisitCall(Call* expr) { // Function calls both through IC and call stub are breakable. is_breakable_ = true; } void BreakableStatementChecker::VisitCallNew(CallNew* expr) { // Function calls through new are breakable. is_breakable_ = true; } void BreakableStatementChecker::VisitCallRuntime(CallRuntime* expr) { } void BreakableStatementChecker::VisitUnaryOperation(UnaryOperation* expr) { Visit(expr->expression()); } void BreakableStatementChecker::VisitCountOperation(CountOperation* expr) { Visit(expr->expression()); } void BreakableStatementChecker::VisitBinaryOperation(BinaryOperation* expr) { Visit(expr->left()); if (expr->op() != Token::AND && expr->op() != Token::OR) { Visit(expr->right()); } } void BreakableStatementChecker::VisitCompareToNull(CompareToNull* expr) { Visit(expr->expression()); } void BreakableStatementChecker::VisitCompareOperation(CompareOperation* expr) { Visit(expr->left()); Visit(expr->right()); } void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) { } #define __ ACCESS_MASM(masm()) bool FullCodeGenerator::MakeCode(CompilationInfo* info) { Isolate* isolate = info->isolate(); Handle
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册