Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp
  2. +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp
  3. @@ -116,11 +116,11 @@ Interpreter::ErrorHandlingMode::~ErrorHandlingMode()
  4. Interpreter::StackPolicy::StackPolicy(Interpreter& interpreter, const StackBounds& stack)
  5. : m_interpreter(interpreter)
  6. {
  7. - int size = stack.size();
  8. + size_t size = stack.size();
  9.  
  10. - const int DEFAULT_REQUIRED_STACK = 1024 * 1024;
  11. - const int DEFAULT_MINIMUM_USEABLE_STACK = 128 * 1024;
  12. - const int DEFAULT_ERROR_MODE_REQUIRED_STACK = 32 * 1024;
  13. + const size_t DEFAULT_REQUIRED_STACK = 1024 * 1024;
  14. + const size_t DEFAULT_MINIMUM_USEABLE_STACK = 128 * 1024;
  15. + const size_t DEFAULT_ERROR_MODE_REQUIRED_STACK = 32 * 1024;
  16.  
  17. // Here's the policy in a nutshell:
  18. //
  19. @@ -174,10 +174,11 @@ Interpreter::StackPolicy::StackPolicy(Interpreter& interpreter, const StackBound
  20.  
  21. // Policy 1: Normal mode: required = DEFAULT_REQUIRED_STACK.
  22. // Policy 2: Erro mode: required = DEFAULT_ERROR_MODE_REQUIRED_STACK.
  23. - int requiredCapacity = !m_interpreter.m_errorHandlingModeReentry ?
  24. + size_t requiredCapacity = !m_interpreter.m_errorHandlingModeReentry ?
  25. DEFAULT_REQUIRED_STACK : DEFAULT_ERROR_MODE_REQUIRED_STACK;
  26.  
  27. - int useableStack = size - requiredCapacity;
  28. + ASSERT(size >= requiredCapacity);
  29. + size_t useableStack = size - requiredCapacity;
  30.  
  31. // Policy 3: Ensure the useable stack is not too small:
  32. if (useableStack < DEFAULT_MINIMUM_USEABLE_STACK)
  33. @@ -191,8 +192,9 @@ Interpreter::StackPolicy::StackPolicy(Interpreter& interpreter, const StackBound
  34. // Re-compute the requiredCapacity based on the adjusted useable stack
  35. // size:
  36. // interpreter stack checks:
  37. + ASSERT(size >= useableStack);
  38. requiredCapacity = size - useableStack;
  39. - ASSERT((requiredCapacity >= 0) && (requiredCapacity < size));
  40. + ASSERT(requiredCapacity < size);
  41.  
  42. m_requiredCapacity = requiredCapacity;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement