Changeset 29425 in webkit for trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
- Timestamp:
- Jan 11, 2008, 6:08:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r29091 r29425 1 1 /* 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Cameron Zwarich ([email protected]) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 30 31 #include "JSGlobalObject.h" 31 32 32 #include " SavedBuiltins.h"33 #include "Activation.h" 33 34 #include "array_object.h" 34 35 #include "bool_object.h" … … 41 42 #include "object_object.h" 42 43 #include "regexp_object.h" 44 #include "SavedBuiltins.h" 43 45 #include "string_object.h" 44 46 … … 201 203 ExecState* exec = &d()->globalExec; 202 204 205 d()->activations = new ActivationStackNode; 206 d()->activationCount = 0; 207 203 208 // Prototypes 204 209 d()->functionPrototype = new FunctionPrototype(exec); … … 495 500 } 496 501 502 ActivationImp* JSGlobalObject::pushActivation(ExecState* exec) 503 { 504 if (d()->activationCount == activationStackNodeSize) { 505 ActivationStackNode* newNode = new ActivationStackNode; 506 newNode->prev = d()->activations; 507 d()->activations = newNode; 508 d()->activationCount = 0; 509 } 510 511 StackActivation* stackEntry = &d()->activations->data[d()->activationCount++]; 512 stackEntry->activationStorage.init(exec); 513 514 return &(stackEntry->activationStorage); 515 } 516 517 inline void JSGlobalObject::checkActivationCount() 518 { 519 if (!d()->activationCount) { 520 ActivationStackNode* prev = d()->activations->prev; 521 delete d()->activations; 522 d()->activations = prev; 523 d()->activationCount = activationStackNodeSize; 524 } 525 } 526 527 void JSGlobalObject::popActivation() 528 { 529 checkActivationCount(); 530 d()->activations->data[--d()->activationCount].activationDataStorage.localStorage.shrink(0); 531 } 532 533 void JSGlobalObject::tearOffActivation(ExecState* exec, bool leaveRelic) 534 { 535 if (exec->codeType() == FunctionCode && static_cast<ActivationImp*>(exec->activationObject())->isOnStack()) { 536 ActivationImp* oldActivation = static_cast<ActivationImp*>(exec->activationObject()); 537 ActivationImp* newActivation = new ActivationImp(*oldActivation->d(), leaveRelic); 538 539 if (!leaveRelic) { 540 checkActivationCount(); 541 d()->activationCount--; 542 } 543 544 oldActivation->d()->localStorage.shrink(0); 545 546 exec->setActivationObject(newActivation); 547 exec->setVariableObject(newActivation); 548 exec->setLocalStorage(&(newActivation->localStorage())); 549 exec->replaceScopeChainTop(newActivation); 550 } 551 } 552 497 553 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.