OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 | 1378 |
1379 | 1379 |
1380 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the | 1380 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the |
1381 // class as a work around for a bug in the generated code found with these | 1381 // class as a work around for a bug in the generated code found with these |
1382 // versions of GCC. See V8 issue 122 for details. | 1382 // versions of GCC. See V8 issue 122 for details. |
1383 class SaveContext BASE_EMBEDDED { | 1383 class SaveContext BASE_EMBEDDED { |
1384 public: | 1384 public: |
1385 inline explicit SaveContext(Isolate* isolate); | 1385 inline explicit SaveContext(Isolate* isolate); |
1386 | 1386 |
1387 ~SaveContext() { | 1387 ~SaveContext() { |
1388 if (context_.is_null()) { | 1388 isolate_->set_context(context_.is_null() ? NULL : *context_); |
1389 Isolate* isolate = Isolate::Current(); | 1389 isolate_->set_save_context(prev_); |
1390 isolate->set_context(NULL); | |
1391 isolate->set_save_context(prev_); | |
1392 } else { | |
1393 Isolate* isolate = context_->GetIsolate(); | |
1394 isolate->set_context(*context_); | |
1395 isolate->set_save_context(prev_); | |
1396 } | |
1397 } | 1390 } |
1398 | 1391 |
1399 Handle<Context> context() { return context_; } | 1392 Handle<Context> context() { return context_; } |
1400 SaveContext* prev() { return prev_; } | 1393 SaveContext* prev() { return prev_; } |
1401 | 1394 |
1402 // Returns true if this save context is below a given JavaScript frame. | 1395 // Returns true if this save context is below a given JavaScript frame. |
1403 bool IsBelowFrame(JavaScriptFrame* frame) { | 1396 bool IsBelowFrame(JavaScriptFrame* frame) { |
1404 return (c_entry_fp_ == 0) || (c_entry_fp_ > frame->sp()); | 1397 return (c_entry_fp_ == 0) || (c_entry_fp_ > frame->sp()); |
1405 } | 1398 } |
1406 | 1399 |
1407 private: | 1400 private: |
| 1401 Isolate* isolate_; |
1408 Handle<Context> context_; | 1402 Handle<Context> context_; |
1409 SaveContext* prev_; | 1403 SaveContext* prev_; |
1410 Address c_entry_fp_; | 1404 Address c_entry_fp_; |
1411 }; | 1405 }; |
1412 | 1406 |
1413 | 1407 |
1414 class AssertNoContextChange BASE_EMBEDDED { | 1408 class AssertNoContextChange BASE_EMBEDDED { |
1415 #ifdef DEBUG | 1409 #ifdef DEBUG |
1416 public: | 1410 public: |
1417 AssertNoContextChange() : context_(Isolate::Current()->context()) { } | 1411 AssertNoContextChange() : context_(Isolate::Current()->context()) { } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 | 1514 |
1521 // Mark the native context with out of memory. | 1515 // Mark the native context with out of memory. |
1522 inline void Context::mark_out_of_memory() { | 1516 inline void Context::mark_out_of_memory() { |
1523 native_context()->set_out_of_memory(HEAP->true_value()); | 1517 native_context()->set_out_of_memory(HEAP->true_value()); |
1524 } | 1518 } |
1525 | 1519 |
1526 | 1520 |
1527 } } // namespace v8::internal | 1521 } } // namespace v8::internal |
1528 | 1522 |
1529 #endif // V8_ISOLATE_H_ | 1523 #endif // V8_ISOLATE_H_ |
OLD | NEW |