| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/contexts.h" | 5 #include "src/contexts.h" |
| 6 | 6 |
| 7 #include "src/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST), | 477 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST), |
| 478 UPDATE_WEAK_WRITE_BARRIER); | 478 UPDATE_WEAK_WRITE_BARRIER); |
| 479 set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER); | 479 set(OPTIMIZED_FUNCTIONS_LIST, function, UPDATE_WEAK_WRITE_BARRIER); |
| 480 } | 480 } |
| 481 | 481 |
| 482 | 482 |
| 483 void Context::RemoveOptimizedFunction(JSFunction* function) { | 483 void Context::RemoveOptimizedFunction(JSFunction* function) { |
| 484 DCHECK(IsNativeContext()); | 484 DCHECK(IsNativeContext()); |
| 485 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); | 485 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); |
| 486 JSFunction* prev = NULL; | 486 JSFunction* prev = NULL; |
| 487 while (!element->IsUndefined()) { | 487 Isolate* isolate = function->GetIsolate(); |
| 488 while (!element->IsUndefined(isolate)) { |
| 488 JSFunction* element_function = JSFunction::cast(element); | 489 JSFunction* element_function = JSFunction::cast(element); |
| 489 DCHECK(element_function->next_function_link()->IsUndefined() || | 490 DCHECK(element_function->next_function_link()->IsUndefined(isolate) || |
| 490 element_function->next_function_link()->IsJSFunction()); | 491 element_function->next_function_link()->IsJSFunction()); |
| 491 if (element_function == function) { | 492 if (element_function == function) { |
| 492 if (prev == NULL) { | 493 if (prev == NULL) { |
| 493 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link(), | 494 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link(), |
| 494 UPDATE_WEAK_WRITE_BARRIER); | 495 UPDATE_WEAK_WRITE_BARRIER); |
| 495 } else { | 496 } else { |
| 496 prev->set_next_function_link(element_function->next_function_link(), | 497 prev->set_next_function_link(element_function->next_function_link(), |
| 497 UPDATE_WEAK_WRITE_BARRIER); | 498 UPDATE_WEAK_WRITE_BARRIER); |
| 498 } | 499 } |
| 499 element_function->set_next_function_link(GetHeap()->undefined_value(), | 500 element_function->set_next_function_link(GetHeap()->undefined_value(), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 549 |
| 549 Object* Context::DeoptimizedCodeListHead() { | 550 Object* Context::DeoptimizedCodeListHead() { |
| 550 DCHECK(IsNativeContext()); | 551 DCHECK(IsNativeContext()); |
| 551 return get(DEOPTIMIZED_CODE_LIST); | 552 return get(DEOPTIMIZED_CODE_LIST); |
| 552 } | 553 } |
| 553 | 554 |
| 554 | 555 |
| 555 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { | 556 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { |
| 556 Isolate* isolate = GetIsolate(); | 557 Isolate* isolate = GetIsolate(); |
| 557 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); | 558 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); |
| 558 if (!result->IsUndefined()) return result; | 559 if (!result->IsUndefined(isolate)) return result; |
| 559 return isolate->factory()->NewStringFromStaticChars( | 560 return isolate->factory()->NewStringFromStaticChars( |
| 560 "Code generation from strings disallowed for this context"); | 561 "Code generation from strings disallowed for this context"); |
| 561 } | 562 } |
| 562 | 563 |
| 563 | 564 |
| 564 #define COMPARE_NAME(index, type, name) \ | 565 #define COMPARE_NAME(index, type, name) \ |
| 565 if (string->IsOneByteEqualTo(STATIC_CHAR_VECTOR(#name))) return index; | 566 if (string->IsOneByteEqualTo(STATIC_CHAR_VECTOR(#name))) return index; |
| 566 | 567 |
| 567 int Context::ImportedFieldIndexForName(Handle<String> string) { | 568 int Context::ImportedFieldIndexForName(Handle<String> string) { |
| 568 NATIVE_CONTEXT_IMPORTED_FIELDS(COMPARE_NAME) | 569 NATIVE_CONTEXT_IMPORTED_FIELDS(COMPARE_NAME) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 608 |
| 608 int previous_value = errors_thrown()->value(); | 609 int previous_value = errors_thrown()->value(); |
| 609 set_errors_thrown(Smi::FromInt(previous_value + 1)); | 610 set_errors_thrown(Smi::FromInt(previous_value + 1)); |
| 610 } | 611 } |
| 611 | 612 |
| 612 | 613 |
| 613 int Context::GetErrorsThrown() { return errors_thrown()->value(); } | 614 int Context::GetErrorsThrown() { return errors_thrown()->value(); } |
| 614 | 615 |
| 615 } // namespace internal | 616 } // namespace internal |
| 616 } // namespace v8 | 617 } // namespace v8 |
| OLD | NEW |