OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 Heap* heap = GetHeap(); | 1927 Heap* heap = GetHeap(); |
1928 Isolate* isolate = heap->isolate(); | 1928 Isolate* isolate = heap->isolate(); |
1929 MaybeObject* result; | 1929 MaybeObject* result; |
1930 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && | 1930 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && |
1931 !map_of_this->is_extensible()) { | 1931 !map_of_this->is_extensible()) { |
1932 if (strict_mode == kNonStrictMode) { | 1932 if (strict_mode == kNonStrictMode) { |
1933 return value; | 1933 return value; |
1934 } else { | 1934 } else { |
1935 Handle<Object> args[1] = {Handle<Name>(name)}; | 1935 Handle<Object> args[1] = {Handle<Name>(name)}; |
1936 return isolate->Throw( | 1936 return isolate->Throw( |
1937 *FACTORY->NewTypeError("object_not_extensible", | 1937 *isolate->factory()->NewTypeError("object_not_extensible", |
1938 HandleVector(args, 1))); | 1938 HandleVector(args, 1))); |
1939 } | 1939 } |
1940 } | 1940 } |
1941 | 1941 |
1942 if (HasFastProperties()) { | 1942 if (HasFastProperties()) { |
1943 // Ensure the descriptor array does not get too big. | 1943 // Ensure the descriptor array does not get too big. |
1944 if (map_of_this->NumberOfOwnDescriptors() < | 1944 if (map_of_this->NumberOfOwnDescriptors() < |
1945 DescriptorArray::kMaxNumberOfDescriptors) { | 1945 DescriptorArray::kMaxNumberOfDescriptors) { |
1946 if (value->IsJSFunction()) { | 1946 if (value->IsJSFunction()) { |
1947 result = AddConstantFunctionProperty(name, | 1947 result = AddConstantFunctionProperty(name, |
1948 JSFunction::cast(value), | 1948 JSFunction::cast(value), |
(...skipping 9248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11197 // prototype cycles are prevented. | 11197 // prototype cycles are prevented. |
11198 // It is sufficient to validate that the receiver is not in the new prototype | 11198 // It is sufficient to validate that the receiver is not in the new prototype |
11199 // chain. | 11199 // chain. |
11200 for (Object* pt = value; | 11200 for (Object* pt = value; |
11201 pt != heap->null_value(); | 11201 pt != heap->null_value(); |
11202 pt = pt->GetPrototype(isolate)) { | 11202 pt = pt->GetPrototype(isolate)) { |
11203 if (JSReceiver::cast(pt) == this) { | 11203 if (JSReceiver::cast(pt) == this) { |
11204 // Cycle detected. | 11204 // Cycle detected. |
11205 HandleScope scope(isolate); | 11205 HandleScope scope(isolate); |
11206 return isolate->Throw( | 11206 return isolate->Throw( |
11207 *FACTORY->NewError("cyclic_proto", HandleVector<Object>(NULL, 0))); | 11207 *isolate->factory()->NewError("cyclic_proto", |
| 11208 HandleVector<Object>(NULL, 0))); |
11208 } | 11209 } |
11209 } | 11210 } |
11210 | 11211 |
11211 JSReceiver* real_receiver = this; | 11212 JSReceiver* real_receiver = this; |
11212 | 11213 |
11213 if (skip_hidden_prototypes) { | 11214 if (skip_hidden_prototypes) { |
11214 // Find the first object in the chain whose prototype object is not | 11215 // Find the first object in the chain whose prototype object is not |
11215 // hidden and set the new prototype on that object. | 11216 // hidden and set the new prototype on that object. |
11216 Object* current_proto = real_receiver->GetPrototype(); | 11217 Object* current_proto = real_receiver->GetPrototype(); |
11217 while (current_proto->IsJSObject() && | 11218 while (current_proto->IsJSObject() && |
(...skipping 4230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15448 } | 15449 } |
15449 } | 15450 } |
15450 // If the break point was found in the list change it. | 15451 // If the break point was found in the list change it. |
15451 if (found_count > 0) break_point_info->set_break_point_objects(*new_array); | 15452 if (found_count > 0) break_point_info->set_break_point_objects(*new_array); |
15452 } | 15453 } |
15453 | 15454 |
15454 | 15455 |
15455 // Add the specified break point object. | 15456 // Add the specified break point object. |
15456 void BreakPointInfo::SetBreakPoint(Handle<BreakPointInfo> break_point_info, | 15457 void BreakPointInfo::SetBreakPoint(Handle<BreakPointInfo> break_point_info, |
15457 Handle<Object> break_point_object) { | 15458 Handle<Object> break_point_object) { |
| 15459 Isolate* isolate = break_point_info->GetIsolate(); |
| 15460 |
15458 // If there was no break point objects before just set it. | 15461 // If there was no break point objects before just set it. |
15459 if (break_point_info->break_point_objects()->IsUndefined()) { | 15462 if (break_point_info->break_point_objects()->IsUndefined()) { |
15460 break_point_info->set_break_point_objects(*break_point_object); | 15463 break_point_info->set_break_point_objects(*break_point_object); |
15461 return; | 15464 return; |
15462 } | 15465 } |
15463 // If the break point object is the same as before just ignore. | 15466 // If the break point object is the same as before just ignore. |
15464 if (break_point_info->break_point_objects() == *break_point_object) return; | 15467 if (break_point_info->break_point_objects() == *break_point_object) return; |
15465 // If there was one break point object before replace with array. | 15468 // If there was one break point object before replace with array. |
15466 if (!break_point_info->break_point_objects()->IsFixedArray()) { | 15469 if (!break_point_info->break_point_objects()->IsFixedArray()) { |
15467 Handle<FixedArray> array = FACTORY->NewFixedArray(2); | 15470 Handle<FixedArray> array = isolate->factory()->NewFixedArray(2); |
15468 array->set(0, break_point_info->break_point_objects()); | 15471 array->set(0, break_point_info->break_point_objects()); |
15469 array->set(1, *break_point_object); | 15472 array->set(1, *break_point_object); |
15470 break_point_info->set_break_point_objects(*array); | 15473 break_point_info->set_break_point_objects(*array); |
15471 return; | 15474 return; |
15472 } | 15475 } |
15473 // If there was more than one break point before extend array. | 15476 // If there was more than one break point before extend array. |
15474 Handle<FixedArray> old_array = | 15477 Handle<FixedArray> old_array = |
15475 Handle<FixedArray>( | 15478 Handle<FixedArray>( |
15476 FixedArray::cast(break_point_info->break_point_objects())); | 15479 FixedArray::cast(break_point_info->break_point_objects())); |
15477 Handle<FixedArray> new_array = | 15480 Handle<FixedArray> new_array = |
15478 FACTORY->NewFixedArray(old_array->length() + 1); | 15481 isolate->factory()->NewFixedArray(old_array->length() + 1); |
15479 for (int i = 0; i < old_array->length(); i++) { | 15482 for (int i = 0; i < old_array->length(); i++) { |
15480 // If the break point was there before just ignore. | 15483 // If the break point was there before just ignore. |
15481 if (old_array->get(i) == *break_point_object) return; | 15484 if (old_array->get(i) == *break_point_object) return; |
15482 new_array->set(i, old_array->get(i)); | 15485 new_array->set(i, old_array->get(i)); |
15483 } | 15486 } |
15484 // Add the new break point. | 15487 // Add the new break point. |
15485 new_array->set(old_array->length(), *break_point_object); | 15488 new_array->set(old_array->length(), *break_point_object); |
15486 break_point_info->set_break_point_objects(*new_array); | 15489 break_point_info->set_break_point_objects(*new_array); |
15487 } | 15490 } |
15488 | 15491 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15642 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 15645 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
15643 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 15646 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
15644 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 15647 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
15645 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 15648 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
15646 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 15649 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
15647 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 15650 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
15648 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 15651 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
15649 } | 15652 } |
15650 | 15653 |
15651 } } // namespace v8::internal | 15654 } } // namespace v8::internal |
OLD | NEW |