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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 Object** HandleScope::Extend(Isolate* isolate) { | 57 Object** HandleScope::Extend(Isolate* isolate) { |
58 v8::ImplementationUtilities::HandleScopeData* current = | 58 v8::ImplementationUtilities::HandleScopeData* current = |
59 isolate->handle_scope_data(); | 59 isolate->handle_scope_data(); |
60 | 60 |
61 Object** result = current->next; | 61 Object** result = current->next; |
62 | 62 |
63 ASSERT(result == current->limit); | 63 ASSERT(result == current->limit); |
64 // Make sure there's at least one scope on the stack and that the | 64 // Make sure there's at least one scope on the stack and that the |
65 // top of the scope stack isn't a barrier. | 65 // top of the scope stack isn't a barrier. |
66 if (current->level == 0) { | 66 if (!Utils::ApiCheck(current->level != 0, |
67 Utils::ReportApiFailure("v8::HandleScope::CreateHandle()", | 67 "v8::HandleScope::CreateHandle()", |
68 "Cannot create a handle without a HandleScope"); | 68 "Cannot create a handle without a HandleScope")) { |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
71 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | 71 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
72 // If there's more room in the last block, we use that. This is used | 72 // If there's more room in the last block, we use that. This is used |
73 // for fast creation of scopes after scope barriers. | 73 // for fast creation of scopes after scope barriers. |
74 if (!impl->blocks()->is_empty()) { | 74 if (!impl->blocks()->is_empty()) { |
75 Object** limit = &impl->blocks()->last()[kHandleBlockSize]; | 75 Object** limit = &impl->blocks()->last()[kHandleBlockSize]; |
76 if (current->limit != limit) { | 76 if (current->limit != limit) { |
77 current->limit = limit; | 77 current->limit = limit; |
78 ASSERT(limit - current->next < kHandleBlockSize); | 78 ASSERT(limit - current->next < kHandleBlockSize); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 Handle<Code> code) { | 794 Handle<Code> code) { |
795 heap->EnsureWeakObjectToCodeTable(); | 795 heap->EnsureWeakObjectToCodeTable(); |
796 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); | 796 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); |
797 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); | 797 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); |
798 CALL_HEAP_FUNCTION_VOID(heap->isolate(), | 798 CALL_HEAP_FUNCTION_VOID(heap->isolate(), |
799 heap->AddWeakObjectToCodeDependency(*object, *dep)); | 799 heap->AddWeakObjectToCodeDependency(*object, *dep)); |
800 } | 800 } |
801 | 801 |
802 | 802 |
803 } } // namespace v8::internal | 803 } } // namespace v8::internal |
OLD | NEW |