OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 10506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10517 StrictModeFlag strict_mode) | 10517 StrictModeFlag strict_mode) |
10518 : source_(source), | 10518 : source_(source), |
10519 shared_(shared), | 10519 shared_(shared), |
10520 strict_mode_(strict_mode) { } | 10520 strict_mode_(strict_mode) { } |
10521 | 10521 |
10522 bool IsMatch(Object* other) { | 10522 bool IsMatch(Object* other) { |
10523 if (!other->IsFixedArray()) return false; | 10523 if (!other->IsFixedArray()) return false; |
10524 FixedArray* pair = FixedArray::cast(other); | 10524 FixedArray* pair = FixedArray::cast(other); |
10525 SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); | 10525 SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); |
10526 if (shared != shared_) return false; | 10526 if (shared != shared_) return false; |
10527 StrictModeFlag strict_mode = static_cast<StrictModeFlag>( | 10527 int strict_unchecked = Smi::cast(pair->get(2))->value(); |
10528 Smi::cast(pair->get(2))->value()); | 10528 ASSERT(strict_unchecked == kStrictMode || |
| 10529 strict_unchecked == kNonStrictMode); |
| 10530 StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked); |
10529 if (strict_mode != strict_mode_) return false; | 10531 if (strict_mode != strict_mode_) return false; |
10530 String* source = String::cast(pair->get(1)); | 10532 String* source = String::cast(pair->get(1)); |
10531 return source->Equals(source_); | 10533 return source->Equals(source_); |
10532 } | 10534 } |
10533 | 10535 |
10534 static uint32_t StringSharedHashHelper(String* source, | 10536 static uint32_t StringSharedHashHelper(String* source, |
10535 SharedFunctionInfo* shared, | 10537 SharedFunctionInfo* shared, |
10536 StrictModeFlag strict_mode) { | 10538 StrictModeFlag strict_mode) { |
10537 uint32_t hash = source->Hash(); | 10539 uint32_t hash = source->Hash(); |
10538 if (shared->HasSourceCode()) { | 10540 if (shared->HasSourceCode()) { |
(...skipping 11 matching lines...) Expand all Loading... |
10550 } | 10552 } |
10551 | 10553 |
10552 uint32_t Hash() { | 10554 uint32_t Hash() { |
10553 return StringSharedHashHelper(source_, shared_, strict_mode_); | 10555 return StringSharedHashHelper(source_, shared_, strict_mode_); |
10554 } | 10556 } |
10555 | 10557 |
10556 uint32_t HashForObject(Object* obj) { | 10558 uint32_t HashForObject(Object* obj) { |
10557 FixedArray* pair = FixedArray::cast(obj); | 10559 FixedArray* pair = FixedArray::cast(obj); |
10558 SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); | 10560 SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); |
10559 String* source = String::cast(pair->get(1)); | 10561 String* source = String::cast(pair->get(1)); |
10560 StrictModeFlag strict_mode = static_cast<StrictModeFlag>( | 10562 int strict_unchecked = Smi::cast(pair->get(2))->value(); |
10561 Smi::cast(pair->get(2))->value()); | 10563 ASSERT(strict_unchecked == kStrictMode || |
| 10564 strict_unchecked == kNonStrictMode); |
| 10565 StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked); |
10562 return StringSharedHashHelper(source, shared, strict_mode); | 10566 return StringSharedHashHelper(source, shared, strict_mode); |
10563 } | 10567 } |
10564 | 10568 |
10565 MUST_USE_RESULT MaybeObject* AsObject() { | 10569 MUST_USE_RESULT MaybeObject* AsObject() { |
10566 Object* obj; | 10570 Object* obj; |
10567 { MaybeObject* maybe_obj = source_->GetHeap()->AllocateFixedArray(3); | 10571 { MaybeObject* maybe_obj = source_->GetHeap()->AllocateFixedArray(3); |
10568 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 10572 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
10569 } | 10573 } |
10570 FixedArray* pair = FixedArray::cast(obj); | 10574 FixedArray* pair = FixedArray::cast(obj); |
10571 pair->set(0, shared_); | 10575 pair->set(0, shared_); |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12748 if (break_point_objects()->IsUndefined()) return 0; | 12752 if (break_point_objects()->IsUndefined()) return 0; |
12749 // Single break point. | 12753 // Single break point. |
12750 if (!break_point_objects()->IsFixedArray()) return 1; | 12754 if (!break_point_objects()->IsFixedArray()) return 1; |
12751 // Multiple break points. | 12755 // Multiple break points. |
12752 return FixedArray::cast(break_point_objects())->length(); | 12756 return FixedArray::cast(break_point_objects())->length(); |
12753 } | 12757 } |
12754 #endif // ENABLE_DEBUGGER_SUPPORT | 12758 #endif // ENABLE_DEBUGGER_SUPPORT |
12755 | 12759 |
12756 | 12760 |
12757 } } // namespace v8::internal | 12761 } } // namespace v8::internal |
OLD | NEW |