OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 if (name->length() > 0) result = handle(name, isolate); | 2564 if (name->length() > 0) result = handle(name, isolate); |
2565 } | 2565 } |
2566 | 2566 |
2567 return result.is_identical_to(isolate->factory()->Object_string()) | 2567 return result.is_identical_to(isolate->factory()->Object_string()) |
2568 ? handle(receiver->class_name()) | 2568 ? handle(receiver->class_name()) |
2569 : result; | 2569 : result; |
2570 } | 2570 } |
2571 | 2571 |
2572 | 2572 |
2573 Context* JSReceiver::GetCreationContext() { | 2573 Context* JSReceiver::GetCreationContext() { |
2574 if (IsJSBoundFunction()) { | 2574 JSReceiver* receiver = this; |
2575 return JSBoundFunction::cast(this)->creation_context(); | 2575 while (receiver->IsJSBoundFunction()) { |
| 2576 receiver = JSBoundFunction::cast(receiver)->bound_target_function(); |
2576 } | 2577 } |
2577 Object* constructor = map()->GetConstructor(); | 2578 Object* constructor = receiver->map()->GetConstructor(); |
2578 JSFunction* function; | 2579 JSFunction* function; |
2579 if (constructor->IsJSFunction()) { | 2580 if (constructor->IsJSFunction()) { |
2580 function = JSFunction::cast(constructor); | 2581 function = JSFunction::cast(constructor); |
2581 } else { | 2582 } else { |
2582 // Functions have null as a constructor, | 2583 // Functions have null as a constructor, |
2583 // but any JSFunction knows its context immediately. | 2584 // but any JSFunction knows its context immediately. |
2584 CHECK(IsJSFunction()); | 2585 CHECK(receiver->IsJSFunction()); |
2585 function = JSFunction::cast(this); | 2586 function = JSFunction::cast(receiver); |
2586 } | 2587 } |
2587 | 2588 |
2588 return function->context()->native_context(); | 2589 return function->context()->native_context(); |
2589 } | 2590 } |
2590 | 2591 |
2591 | 2592 |
2592 static Handle<Object> WrapType(Handle<HeapType> type) { | 2593 static Handle<Object> WrapType(Handle<HeapType> type) { |
2593 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); | 2594 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); |
2594 return type; | 2595 return type; |
2595 } | 2596 } |
(...skipping 17094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19690 if (cell->value() != *new_value) { | 19691 if (cell->value() != *new_value) { |
19691 cell->set_value(*new_value); | 19692 cell->set_value(*new_value); |
19692 Isolate* isolate = cell->GetIsolate(); | 19693 Isolate* isolate = cell->GetIsolate(); |
19693 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19694 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19694 isolate, DependentCode::kPropertyCellChangedGroup); | 19695 isolate, DependentCode::kPropertyCellChangedGroup); |
19695 } | 19696 } |
19696 } | 19697 } |
19697 | 19698 |
19698 } // namespace internal | 19699 } // namespace internal |
19699 } // namespace v8 | 19700 } // namespace v8 |
OLD | NEW |