OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 | 417 |
418 // Check if a map originates from a given native context. We use this | 418 // Check if a map originates from a given native context. We use this |
419 // information to filter out maps from different context to avoid | 419 // information to filter out maps from different context to avoid |
420 // retaining objects from different tabs in Chrome via optimized code. | 420 // retaining objects from different tabs in Chrome via optimized code. |
421 bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, | 421 bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, |
422 Context* native_context) { | 422 Context* native_context) { |
423 Object* constructor = NULL; | 423 Object* constructor = NULL; |
424 while (!map->prototype()->IsNull()) { | 424 while (!map->prototype()->IsNull()) { |
425 constructor = map->constructor(); | 425 constructor = map->GetConstructor(); |
426 if (!constructor->IsNull()) { | 426 if (!constructor->IsNull()) { |
427 // If the constructor is not null or a JSFunction, we have to | 427 // If the constructor is not null or a JSFunction, we have to |
428 // conservatively assume that it may retain a native context. | 428 // conservatively assume that it may retain a native context. |
429 if (!constructor->IsJSFunction()) return true; | 429 if (!constructor->IsJSFunction()) return true; |
430 // Check if the constructor directly references a foreign context. | 430 // Check if the constructor directly references a foreign context. |
431 if (CanRetainOtherContext(JSFunction::cast(constructor), | 431 if (CanRetainOtherContext(JSFunction::cast(constructor), |
432 native_context)) { | 432 native_context)) { |
433 return true; | 433 return true; |
434 } | 434 } |
435 } | 435 } |
436 map = HeapObject::cast(map->prototype())->map(); | 436 map = HeapObject::cast(map->prototype())->map(); |
437 } | 437 } |
438 constructor = map->constructor(); | 438 constructor = map->GetConstructor(); |
439 if (constructor->IsNull()) return false; | 439 if (constructor->IsNull()) return false; |
440 JSFunction* function = JSFunction::cast(constructor); | 440 JSFunction* function = JSFunction::cast(constructor); |
441 return CanRetainOtherContext(function, native_context); | 441 return CanRetainOtherContext(function, native_context); |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, | 445 bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, |
446 Context* native_context) { | 446 Context* native_context) { |
447 return function->context()->global_object() != native_context->global_object() | 447 return function->context()->global_object() != native_context->global_object() |
448 && function->context()->global_object() != native_context->builtins(); | 448 && function->context()->global_object() != native_context->builtins(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 UnseededNumberDictionary::kNotFound); | 562 UnseededNumberDictionary::kNotFound); |
563 // Dictionary has been allocated with sufficient size for all elements. | 563 // Dictionary has been allocated with sufficient size for all elements. |
564 DisallowHeapAllocation no_need_to_resize_dictionary; | 564 DisallowHeapAllocation no_need_to_resize_dictionary; |
565 HandleScope scope(isolate()); | 565 HandleScope scope(isolate()); |
566 USE(UnseededNumberDictionary::AtNumberPut( | 566 USE(UnseededNumberDictionary::AtNumberPut( |
567 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 567 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
568 } | 568 } |
569 | 569 |
570 | 570 |
571 } } // namespace v8::internal | 571 } } // namespace v8::internal |
OLD | NEW |