OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 } | 4317 } |
4318 result->NotFound(); | 4318 result->NotFound(); |
4319 } | 4319 } |
4320 | 4320 |
4321 | 4321 |
4322 // Try to update an accessor in an elements dictionary. Return true if the | 4322 // Try to update an accessor in an elements dictionary. Return true if the |
4323 // update succeeded, and false otherwise. | 4323 // update succeeded, and false otherwise. |
4324 static bool UpdateGetterSetterInDictionary( | 4324 static bool UpdateGetterSetterInDictionary( |
4325 SeededNumberDictionary* dictionary, | 4325 SeededNumberDictionary* dictionary, |
4326 uint32_t index, | 4326 uint32_t index, |
4327 AccessorComponent component, | 4327 Object* getter, |
4328 Object* fun, | 4328 Object* setter, |
4329 PropertyAttributes attributes) { | 4329 PropertyAttributes attributes) { |
4330 int entry = dictionary->FindEntry(index); | 4330 int entry = dictionary->FindEntry(index); |
4331 if (entry != SeededNumberDictionary::kNotFound) { | 4331 if (entry != SeededNumberDictionary::kNotFound) { |
4332 Object* result = dictionary->ValueAt(entry); | 4332 Object* result = dictionary->ValueAt(entry); |
4333 PropertyDetails details = dictionary->DetailsAt(entry); | 4333 PropertyDetails details = dictionary->DetailsAt(entry); |
4334 // TODO(mstarzinger): We should check for details.IsDontDelete() here once | |
4335 // we only call into the runtime once to set both getter and setter. | |
4336 if (details.type() == CALLBACKS && result->IsAccessorPair()) { | 4334 if (details.type() == CALLBACKS && result->IsAccessorPair()) { |
| 4335 ASSERT(!details.IsDontDelete()); |
4337 if (details.attributes() != attributes) { | 4336 if (details.attributes() != attributes) { |
4338 dictionary->DetailsAtPut(entry, | 4337 dictionary->DetailsAtPut(entry, |
4339 PropertyDetails(attributes, CALLBACKS, index)); | 4338 PropertyDetails(attributes, CALLBACKS, index)); |
4340 } | 4339 } |
4341 AccessorPair::cast(result)->set(component, fun); | 4340 AccessorPair::cast(result)->SetComponents(getter, setter); |
4342 return true; | 4341 return true; |
4343 } | 4342 } |
4344 } | 4343 } |
4345 return false; | 4344 return false; |
4346 } | 4345 } |
4347 | 4346 |
4348 | 4347 |
4349 MaybeObject* JSObject::DefineElementAccessor(uint32_t index, | 4348 MaybeObject* JSObject::DefineElementAccessor(uint32_t index, |
4350 AccessorComponent component, | 4349 Object* getter, |
4351 Object* fun, | 4350 Object* setter, |
4352 PropertyAttributes attributes) { | 4351 PropertyAttributes attributes) { |
4353 switch (GetElementsKind()) { | 4352 switch (GetElementsKind()) { |
4354 case FAST_SMI_ONLY_ELEMENTS: | 4353 case FAST_SMI_ONLY_ELEMENTS: |
4355 case FAST_ELEMENTS: | 4354 case FAST_ELEMENTS: |
4356 case FAST_DOUBLE_ELEMENTS: | 4355 case FAST_DOUBLE_ELEMENTS: |
4357 break; | 4356 break; |
4358 case EXTERNAL_PIXEL_ELEMENTS: | 4357 case EXTERNAL_PIXEL_ELEMENTS: |
4359 case EXTERNAL_BYTE_ELEMENTS: | 4358 case EXTERNAL_BYTE_ELEMENTS: |
4360 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 4359 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
4361 case EXTERNAL_SHORT_ELEMENTS: | 4360 case EXTERNAL_SHORT_ELEMENTS: |
4362 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 4361 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
4363 case EXTERNAL_INT_ELEMENTS: | 4362 case EXTERNAL_INT_ELEMENTS: |
4364 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 4363 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
4365 case EXTERNAL_FLOAT_ELEMENTS: | 4364 case EXTERNAL_FLOAT_ELEMENTS: |
4366 case EXTERNAL_DOUBLE_ELEMENTS: | 4365 case EXTERNAL_DOUBLE_ELEMENTS: |
4367 // Ignore getters and setters on pixel and external array elements. | 4366 // Ignore getters and setters on pixel and external array elements. |
4368 return GetHeap()->undefined_value(); | 4367 return GetHeap()->undefined_value(); |
4369 case DICTIONARY_ELEMENTS: | 4368 case DICTIONARY_ELEMENTS: |
4370 if (UpdateGetterSetterInDictionary(element_dictionary(), | 4369 if (UpdateGetterSetterInDictionary(element_dictionary(), |
4371 index, | 4370 index, |
4372 component, | 4371 getter, |
4373 fun, | 4372 setter, |
4374 attributes)) { | 4373 attributes)) { |
4375 return GetHeap()->undefined_value(); | 4374 return GetHeap()->undefined_value(); |
4376 } | 4375 } |
4377 break; | 4376 break; |
4378 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 4377 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
4379 // Ascertain whether we have read-only properties or an existing | 4378 // Ascertain whether we have read-only properties or an existing |
4380 // getter/setter pair in an arguments elements dictionary backing | 4379 // getter/setter pair in an arguments elements dictionary backing |
4381 // store. | 4380 // store. |
4382 FixedArray* parameter_map = FixedArray::cast(elements()); | 4381 FixedArray* parameter_map = FixedArray::cast(elements()); |
4383 uint32_t length = parameter_map->length(); | 4382 uint32_t length = parameter_map->length(); |
4384 Object* probe = | 4383 Object* probe = |
4385 index < (length - 2) ? parameter_map->get(index + 2) : NULL; | 4384 index < (length - 2) ? parameter_map->get(index + 2) : NULL; |
4386 if (probe == NULL || probe->IsTheHole()) { | 4385 if (probe == NULL || probe->IsTheHole()) { |
4387 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); | 4386 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
4388 if (arguments->IsDictionary()) { | 4387 if (arguments->IsDictionary()) { |
4389 SeededNumberDictionary* dictionary = | 4388 SeededNumberDictionary* dictionary = |
4390 SeededNumberDictionary::cast(arguments); | 4389 SeededNumberDictionary::cast(arguments); |
4391 if (UpdateGetterSetterInDictionary(dictionary, | 4390 if (UpdateGetterSetterInDictionary(dictionary, |
4392 index, | 4391 index, |
4393 component, | 4392 getter, |
4394 fun, | 4393 setter, |
4395 attributes)) { | 4394 attributes)) { |
4396 return GetHeap()->undefined_value(); | 4395 return GetHeap()->undefined_value(); |
4397 } | 4396 } |
4398 } | 4397 } |
4399 } | 4398 } |
4400 break; | 4399 break; |
4401 } | 4400 } |
4402 } | 4401 } |
4403 | 4402 |
4404 AccessorPair* accessors; | 4403 AccessorPair* accessors; |
4405 { MaybeObject* maybe_accessors = GetHeap()->AllocateAccessorPair(); | 4404 { MaybeObject* maybe_accessors = GetHeap()->AllocateAccessorPair(); |
4406 if (!maybe_accessors->To(&accessors)) return maybe_accessors; | 4405 if (!maybe_accessors->To(&accessors)) return maybe_accessors; |
4407 } | 4406 } |
4408 accessors->set(component, fun); | 4407 accessors->SetComponents(getter, setter); |
4409 | 4408 |
4410 return SetElementCallback(index, accessors, attributes); | 4409 return SetElementCallback(index, accessors, attributes); |
4411 } | 4410 } |
4412 | 4411 |
4413 | 4412 |
4414 MaybeObject* JSObject::DefinePropertyAccessor(String* name, | 4413 MaybeObject* JSObject::DefinePropertyAccessor(String* name, |
4415 AccessorComponent component, | 4414 Object* getter, |
4416 Object* fun, | 4415 Object* setter, |
4417 PropertyAttributes attributes) { | 4416 PropertyAttributes attributes) { |
4418 // Lookup the name. | 4417 // Lookup the name. |
4419 LookupResult result(GetHeap()->isolate()); | 4418 LookupResult result(GetHeap()->isolate()); |
4420 LocalLookupRealNamedProperty(name, &result); | 4419 LocalLookupRealNamedProperty(name, &result); |
4421 if (result.IsFound()) { | 4420 if (result.IsFound()) { |
4422 // TODO(mstarzinger): We should check for result.IsDontDelete() here once | |
4423 // we only call into the runtime once to set both getter and setter. | |
4424 if (result.type() == CALLBACKS) { | 4421 if (result.type() == CALLBACKS) { |
| 4422 ASSERT(!result.IsDontDelete()); |
4425 Object* obj = result.GetCallbackObject(); | 4423 Object* obj = result.GetCallbackObject(); |
4426 // Need to preserve old getters/setters. | 4424 // Need to preserve old getters/setters. |
4427 if (obj->IsAccessorPair()) { | 4425 if (obj->IsAccessorPair()) { |
4428 AccessorPair* copy; | 4426 AccessorPair* copy; |
4429 { MaybeObject* maybe_copy = | 4427 { MaybeObject* maybe_copy = |
4430 AccessorPair::cast(obj)->CopyWithoutTransitions(); | 4428 AccessorPair::cast(obj)->CopyWithoutTransitions(); |
4431 if (!maybe_copy->To(©)) return maybe_copy; | 4429 if (!maybe_copy->To(©)) return maybe_copy; |
4432 } | 4430 } |
4433 copy->set(component, fun); | 4431 copy->SetComponents(getter, setter); |
4434 // Use set to update attributes. | 4432 // Use set to update attributes. |
4435 return SetPropertyCallback(name, copy, attributes); | 4433 return SetPropertyCallback(name, copy, attributes); |
4436 } | 4434 } |
4437 } | 4435 } |
4438 } | 4436 } |
4439 | 4437 |
4440 AccessorPair* accessors; | 4438 AccessorPair* accessors; |
4441 { MaybeObject* maybe_accessors = GetHeap()->AllocateAccessorPair(); | 4439 { MaybeObject* maybe_accessors = GetHeap()->AllocateAccessorPair(); |
4442 if (!maybe_accessors->To(&accessors)) return maybe_accessors; | 4440 if (!maybe_accessors->To(&accessors)) return maybe_accessors; |
4443 } | 4441 } |
4444 accessors->set(component, fun); | 4442 accessors->SetComponents(getter, setter); |
4445 | 4443 |
4446 return SetPropertyCallback(name, accessors, attributes); | 4444 return SetPropertyCallback(name, accessors, attributes); |
4447 } | 4445 } |
4448 | 4446 |
4449 | 4447 |
4450 bool JSObject::CanSetCallback(String* name) { | 4448 bool JSObject::CanSetCallback(String* name) { |
4451 ASSERT(!IsAccessCheckNeeded() || | 4449 ASSERT(!IsAccessCheckNeeded() || |
4452 GetIsolate()->MayNamedAccess(this, name, v8::ACCESS_SET)); | 4450 GetIsolate()->MayNamedAccess(this, name, v8::ACCESS_SET)); |
4453 | 4451 |
4454 // Check if there is an API defined callback object which prohibits | 4452 // Check if there is an API defined callback object which prohibits |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4505 set_elements(dictionary); | 4503 set_elements(dictionary); |
4506 } | 4504 } |
4507 | 4505 |
4508 return GetHeap()->undefined_value(); | 4506 return GetHeap()->undefined_value(); |
4509 } | 4507 } |
4510 | 4508 |
4511 | 4509 |
4512 MaybeObject* JSObject::SetPropertyCallback(String* name, | 4510 MaybeObject* JSObject::SetPropertyCallback(String* name, |
4513 Object* structure, | 4511 Object* structure, |
4514 PropertyAttributes attributes) { | 4512 PropertyAttributes attributes) { |
4515 PropertyDetails details = PropertyDetails(attributes, CALLBACKS); | |
4516 | |
4517 bool convert_back_to_fast = HasFastProperties() && | |
4518 (map()->instance_descriptors()->number_of_descriptors() | |
4519 < DescriptorArray::kMaxNumberOfDescriptors); | |
4520 | |
4521 // Normalize object to make this operation simple. | 4513 // Normalize object to make this operation simple. |
4522 { MaybeObject* maybe_ok = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); | 4514 { MaybeObject* maybe_ok = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); |
4523 if (maybe_ok->IsFailure()) return maybe_ok; | 4515 if (maybe_ok->IsFailure()) return maybe_ok; |
4524 } | 4516 } |
4525 | 4517 |
4526 // For the global object allocate a new map to invalidate the global inline | 4518 // For the global object allocate a new map to invalidate the global inline |
4527 // caches which have a global property cell reference directly in the code. | 4519 // caches which have a global property cell reference directly in the code. |
4528 if (IsGlobalObject()) { | 4520 if (IsGlobalObject()) { |
4529 Map* new_map; | 4521 Map* new_map; |
4530 { MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); | 4522 { MaybeObject* maybe_new_map = map()->CopyDropDescriptors(); |
4531 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 4523 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
4532 } | 4524 } |
4533 set_map(new_map); | 4525 set_map(new_map); |
4534 // When running crankshaft, changing the map is not enough. We | 4526 // When running crankshaft, changing the map is not enough. We |
4535 // need to deoptimize all functions that rely on this global | 4527 // need to deoptimize all functions that rely on this global |
4536 // object. | 4528 // object. |
4537 Deoptimizer::DeoptimizeGlobalObject(this); | 4529 Deoptimizer::DeoptimizeGlobalObject(this); |
4538 } | 4530 } |
4539 | 4531 |
4540 // Update the dictionary with the new CALLBACKS property. | 4532 // Update the dictionary with the new CALLBACKS property. |
| 4533 PropertyDetails details = PropertyDetails(attributes, CALLBACKS); |
4541 { MaybeObject* maybe_ok = SetNormalizedProperty(name, structure, details); | 4534 { MaybeObject* maybe_ok = SetNormalizedProperty(name, structure, details); |
4542 if (maybe_ok->IsFailure()) return maybe_ok; | 4535 if (maybe_ok->IsFailure()) return maybe_ok; |
4543 } | 4536 } |
4544 | 4537 |
4545 if (convert_back_to_fast) { | |
4546 MaybeObject* maybe_ok = TransformToFastProperties(0); | |
4547 if (maybe_ok->IsFailure()) return maybe_ok; | |
4548 } | |
4549 return GetHeap()->undefined_value(); | 4538 return GetHeap()->undefined_value(); |
4550 } | 4539 } |
4551 | 4540 |
| 4541 |
| 4542 void JSObject::DefineAccessor(Handle<JSObject> object, |
| 4543 Handle<String> name, |
| 4544 Handle<Object> getter, |
| 4545 Handle<Object> setter, |
| 4546 PropertyAttributes attributes) { |
| 4547 CALL_HEAP_FUNCTION_VOID( |
| 4548 object->GetIsolate(), |
| 4549 object->DefineAccessor(*name, *getter, *setter, attributes)); |
| 4550 } |
| 4551 |
4552 MaybeObject* JSObject::DefineAccessor(String* name, | 4552 MaybeObject* JSObject::DefineAccessor(String* name, |
4553 AccessorComponent component, | 4553 Object* getter, |
4554 Object* fun, | 4554 Object* setter, |
4555 PropertyAttributes attributes) { | 4555 PropertyAttributes attributes) { |
4556 ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); | |
4557 Isolate* isolate = GetIsolate(); | 4556 Isolate* isolate = GetIsolate(); |
4558 // Check access rights if needed. | 4557 // Check access rights if needed. |
4559 if (IsAccessCheckNeeded() && | 4558 if (IsAccessCheckNeeded() && |
4560 !isolate->MayNamedAccess(this, name, v8::ACCESS_SET)) { | 4559 !isolate->MayNamedAccess(this, name, v8::ACCESS_SET)) { |
4561 isolate->ReportFailedAccessCheck(this, v8::ACCESS_SET); | 4560 isolate->ReportFailedAccessCheck(this, v8::ACCESS_SET); |
4562 return isolate->heap()->undefined_value(); | 4561 return isolate->heap()->undefined_value(); |
4563 } | 4562 } |
4564 | 4563 |
4565 if (IsJSGlobalProxy()) { | 4564 if (IsJSGlobalProxy()) { |
4566 Object* proto = GetPrototype(); | 4565 Object* proto = GetPrototype(); |
4567 if (proto->IsNull()) return this; | 4566 if (proto->IsNull()) return this; |
4568 ASSERT(proto->IsJSGlobalObject()); | 4567 ASSERT(proto->IsJSGlobalObject()); |
4569 return JSObject::cast(proto)->DefineAccessor(name, component, | 4568 return JSObject::cast(proto)->DefineAccessor( |
4570 fun, attributes); | 4569 name, getter, setter, attributes); |
4571 } | 4570 } |
4572 | 4571 |
4573 // Make sure that the top context does not change when doing callbacks or | 4572 // Make sure that the top context does not change when doing callbacks or |
4574 // interceptor calls. | 4573 // interceptor calls. |
4575 AssertNoContextChange ncc; | 4574 AssertNoContextChange ncc; |
4576 | 4575 |
4577 // Try to flatten before operating on the string. | 4576 // Try to flatten before operating on the string. |
4578 name->TryFlatten(); | 4577 name->TryFlatten(); |
4579 | 4578 |
4580 if (!CanSetCallback(name)) return isolate->heap()->undefined_value(); | 4579 if (!CanSetCallback(name)) return isolate->heap()->undefined_value(); |
4581 | 4580 |
4582 uint32_t index = 0; | 4581 uint32_t index = 0; |
4583 return name->AsArrayIndex(&index) ? | 4582 return name->AsArrayIndex(&index) ? |
4584 DefineElementAccessor(index, component, fun, attributes) : | 4583 DefineElementAccessor(index, getter, setter, attributes) : |
4585 DefinePropertyAccessor(name, component, fun, attributes); | 4584 DefinePropertyAccessor(name, getter, setter, attributes); |
4586 } | 4585 } |
4587 | 4586 |
4588 | 4587 |
4589 MaybeObject* JSObject::DefineAccessor(AccessorInfo* info) { | 4588 MaybeObject* JSObject::DefineAccessor(AccessorInfo* info) { |
4590 Isolate* isolate = GetIsolate(); | 4589 Isolate* isolate = GetIsolate(); |
4591 String* name = String::cast(info->name()); | 4590 String* name = String::cast(info->name()); |
4592 // Check access rights if needed. | 4591 // Check access rights if needed. |
4593 if (IsAccessCheckNeeded() && | 4592 if (IsAccessCheckNeeded() && |
4594 !isolate->MayNamedAccess(this, name, v8::ACCESS_SET)) { | 4593 !isolate->MayNamedAccess(this, name, v8::ACCESS_SET)) { |
4595 isolate->ReportFailedAccessCheck(this, v8::ACCESS_SET); | 4594 isolate->ReportFailedAccessCheck(this, v8::ACCESS_SET); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 obj != heap->null_value(); | 4688 obj != heap->null_value(); |
4690 obj = JSObject::cast(obj)->GetPrototype()) { | 4689 obj = JSObject::cast(obj)->GetPrototype()) { |
4691 JSObject* js_object = JSObject::cast(obj); | 4690 JSObject* js_object = JSObject::cast(obj); |
4692 if (js_object->HasDictionaryElements()) { | 4691 if (js_object->HasDictionaryElements()) { |
4693 SeededNumberDictionary* dictionary = js_object->element_dictionary(); | 4692 SeededNumberDictionary* dictionary = js_object->element_dictionary(); |
4694 int entry = dictionary->FindEntry(index); | 4693 int entry = dictionary->FindEntry(index); |
4695 if (entry != SeededNumberDictionary::kNotFound) { | 4694 if (entry != SeededNumberDictionary::kNotFound) { |
4696 Object* element = dictionary->ValueAt(entry); | 4695 Object* element = dictionary->ValueAt(entry); |
4697 if (dictionary->DetailsAt(entry).type() == CALLBACKS && | 4696 if (dictionary->DetailsAt(entry).type() == CALLBACKS && |
4698 element->IsAccessorPair()) { | 4697 element->IsAccessorPair()) { |
4699 return AccessorPair::cast(element)->SafeGet(component); | 4698 return AccessorPair::cast(element)->GetComponent(component); |
4700 } | 4699 } |
4701 } | 4700 } |
4702 } | 4701 } |
4703 } | 4702 } |
4704 } else { | 4703 } else { |
4705 for (Object* obj = this; | 4704 for (Object* obj = this; |
4706 obj != heap->null_value(); | 4705 obj != heap->null_value(); |
4707 obj = JSObject::cast(obj)->GetPrototype()) { | 4706 obj = JSObject::cast(obj)->GetPrototype()) { |
4708 LookupResult result(heap->isolate()); | 4707 LookupResult result(heap->isolate()); |
4709 JSObject::cast(obj)->LocalLookup(name, &result); | 4708 JSObject::cast(obj)->LocalLookup(name, &result); |
4710 if (result.IsProperty()) { | 4709 if (result.IsProperty()) { |
4711 if (result.IsReadOnly()) return heap->undefined_value(); | 4710 if (result.IsReadOnly()) return heap->undefined_value(); |
4712 if (result.type() == CALLBACKS) { | 4711 if (result.type() == CALLBACKS) { |
4713 Object* obj = result.GetCallbackObject(); | 4712 Object* obj = result.GetCallbackObject(); |
4714 if (obj->IsAccessorPair()) { | 4713 if (obj->IsAccessorPair()) { |
4715 return AccessorPair::cast(obj)->SafeGet(component); | 4714 return AccessorPair::cast(obj)->GetComponent(component); |
4716 } | 4715 } |
4717 } | 4716 } |
4718 } | 4717 } |
4719 } | 4718 } |
4720 } | 4719 } |
4721 return heap->undefined_value(); | 4720 return heap->undefined_value(); |
4722 } | 4721 } |
4723 | 4722 |
4724 | 4723 |
4725 Object* JSObject::SlowReverseLookup(Object* value) { | 4724 Object* JSObject::SlowReverseLookup(Object* value) { |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 AccessorPair* copy; | 5941 AccessorPair* copy; |
5943 { MaybeObject* maybe_copy = heap->AllocateAccessorPair(); | 5942 { MaybeObject* maybe_copy = heap->AllocateAccessorPair(); |
5944 if (!maybe_copy->To(©)) return maybe_copy; | 5943 if (!maybe_copy->To(©)) return maybe_copy; |
5945 } | 5944 } |
5946 copy->set_getter(getter()->IsMap() ? heap->the_hole_value() : getter()); | 5945 copy->set_getter(getter()->IsMap() ? heap->the_hole_value() : getter()); |
5947 copy->set_setter(setter()->IsMap() ? heap->the_hole_value() : setter()); | 5946 copy->set_setter(setter()->IsMap() ? heap->the_hole_value() : setter()); |
5948 return copy; | 5947 return copy; |
5949 } | 5948 } |
5950 | 5949 |
5951 | 5950 |
5952 Object* AccessorPair::SafeGet(AccessorComponent component) { | 5951 Object* AccessorPair::GetComponent(AccessorComponent component) { |
5953 Object* accessor = get(component); | 5952 Object* accessor = (component == ACCESSOR_GETTER) ? getter() : setter(); |
5954 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; | 5953 return accessor->IsTheHole() ? GetHeap()->undefined_value() : accessor; |
5955 } | 5954 } |
5956 | 5955 |
5957 | 5956 |
5958 MaybeObject* DeoptimizationInputData::Allocate(int deopt_entry_count, | 5957 MaybeObject* DeoptimizationInputData::Allocate(int deopt_entry_count, |
5959 PretenureFlag pretenure) { | 5958 PretenureFlag pretenure) { |
5960 ASSERT(deopt_entry_count > 0); | 5959 ASSERT(deopt_entry_count > 0); |
5961 return HEAP->AllocateFixedArray(LengthFor(deopt_entry_count), | 5960 return HEAP->AllocateFixedArray(LengthFor(deopt_entry_count), |
5962 pretenure); | 5961 pretenure); |
5963 } | 5962 } |
(...skipping 6976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12940 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 12939 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
12941 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 12940 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
12942 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 12941 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
12943 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 12942 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
12944 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 12943 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
12945 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 12944 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
12946 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 12945 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
12947 } | 12946 } |
12948 | 12947 |
12949 } } // namespace v8::internal | 12948 } } // namespace v8::internal |
OLD | NEW |