Changeset 27100 in webkit for trunk/JavaScriptCore/kjs/ExecState.cpp
- Timestamp:
- Oct 26, 2007, 3:36:45 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.cpp
r27098 r27100 1 // -*- c-basic-offset: 2-*-1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 3 * This file is part of the KDE libraries 4 4 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 5 5 * Copyright (C) 2001 Peter Kelly ([email protected]) 6 * Copyright (C) 2003 Apple Computer, Inc.6 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved. 7 7 * 8 8 * This library is free software; you can redistribute it and/or … … 34 34 35 35 // ECMA 10.2 36 Context::Context(JSGlobalObject* glob, Interpreter* interpreter, JSObject* thisV,37 FunctionBodyNode* currentBody, CodeType type, Context* callingCon,38 FunctionImp* func, const List* args)36 ExecState::ExecState(Interpreter* interpreter, JSGlobalObject* glob, JSObject* thisV, 37 FunctionBodyNode* currentBody, CodeType type, ExecState* callingExec, 38 FunctionImp* func, const List* args) 39 39 : m_interpreter(interpreter) 40 , m_savedContext(interpreter->context()) 40 , m_exception(0) 41 , m_propertyNames(CommonIdentifiers::shared()) 42 , m_savedExecState(interpreter->currentExec()) 41 43 , m_currentBody(currentBody) 42 44 , m_function(func) … … 46 48 { 47 49 m_codeType = type; 48 m_calling Context = callingCon;50 m_callingExecState = callingExec; 49 51 50 52 // create and initialize activation object (ECMA 10.1.6) … … 60 62 switch(type) { 61 63 case EvalCode: 62 if (m_calling Context) {63 scope = m_calling Context->scopeChain();64 m_variable = m_calling Context->variableObject();65 m_thisVal = m_calling Context->thisValue();64 if (m_callingExecState) { 65 scope = m_callingExecState->scopeChain(); 66 m_variable = m_callingExecState->variableObject(); 67 m_thisVal = m_callingExecState->thisValue(); 66 68 break; 67 69 } // else same as GlobalCode … … 79 81 } 80 82 81 m_interpreter->setContext(this); 83 if (currentBody) 84 m_interpreter->setCurrentExec(this); 82 85 } 83 86 84 Context::~Context()87 ExecState::~ExecState() 85 88 { 86 m_interpreter->setC ontext(m_savedContext);89 m_interpreter->setCurrentExec(m_savedExecState); 87 90 88 91 // The arguments list is only needed to potentially create the arguments object, … … 95 98 } 96 99 97 void Context::mark()100 void ExecState::mark() 98 101 { 99 for ( Context* context = this; context; context = context->m_callingContext)100 context->scope.mark();102 for (ExecState* exec = this; exec; exec = exec->m_callingExecState) 103 exec->scope.mark(); 101 104 } 102 105 103 106 Interpreter* ExecState::lexicalInterpreter() const 104 107 { 105 if ( !m_context)108 if (scopeChain().isEmpty()) 106 109 return dynamicInterpreter(); 107 110 108 JSObject* object = m_context->scopeChain().bottom();111 JSObject* object = scopeChain().bottom(); 109 112 if (object && object->isGlobalObject()) 110 113 return static_cast<JSGlobalObject*>(object)->interpreter(); … … 113 116 } 114 117 118 115 119 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.