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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 #ifdef ENABLE_DEBUGGER_SUPPORT | 1923 #ifdef ENABLE_DEBUGGER_SUPPORT |
1924 Debug* debug = isolate->debug(); | 1924 Debug* debug = isolate->debug(); |
1925 // Handle stepping into a setter if step into is active. | 1925 // Handle stepping into a setter if step into is active. |
1926 // TODO(rossberg): should this apply to getters that are function proxies? | 1926 // TODO(rossberg): should this apply to getters that are function proxies? |
1927 if (debug->StepInActive() && fun->IsJSFunction()) { | 1927 if (debug->StepInActive() && fun->IsJSFunction()) { |
1928 debug->HandleStepIn( | 1928 debug->HandleStepIn( |
1929 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false); | 1929 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false); |
1930 } | 1930 } |
1931 #endif | 1931 #endif |
1932 bool has_pending_exception; | 1932 bool has_pending_exception; |
1933 Object** argv[] = { value_handle.location() }; | 1933 Handle<Object> argv[] = { value_handle }; |
1934 Execution::Call(fun, self, 1, argv, &has_pending_exception); | 1934 Execution::Call(fun, self, ARRAY_SIZE(argv), argv, &has_pending_exception); |
1935 // Check for pending exception and return the result. | 1935 // Check for pending exception and return the result. |
1936 if (has_pending_exception) return Failure::Exception(); | 1936 if (has_pending_exception) return Failure::Exception(); |
1937 return *value_handle; | 1937 return *value_handle; |
1938 } | 1938 } |
1939 | 1939 |
1940 | 1940 |
1941 void JSObject::LookupCallbackSetterInPrototypes(String* name, | 1941 void JSObject::LookupCallbackSetterInPrototypes(String* name, |
1942 LookupResult* result) { | 1942 LookupResult* result) { |
1943 Heap* heap = GetHeap(); | 1943 Heap* heap = GetHeap(); |
1944 for (Object* pt = GetPrototype(); | 1944 for (Object* pt = GetPrototype(); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 Handle<Object> args[] = { name }; | 2449 Handle<Object> args[] = { name }; |
2450 Handle<Object> result = proxy->CallTrap( | 2450 Handle<Object> result = proxy->CallTrap( |
2451 "getOwnPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); | 2451 "getOwnPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); |
2452 if (isolate->has_pending_exception()) return Failure::Exception(); | 2452 if (isolate->has_pending_exception()) return Failure::Exception(); |
2453 | 2453 |
2454 if (!result->IsUndefined()) { | 2454 if (!result->IsUndefined()) { |
2455 // The proxy handler cares about this property. | 2455 // The proxy handler cares about this property. |
2456 // Check whether it is virtualized as an accessor. | 2456 // Check whether it is virtualized as an accessor. |
2457 // Emulate [[GetProperty]] semantics for proxies. | 2457 // Emulate [[GetProperty]] semantics for proxies. |
2458 bool has_pending_exception; | 2458 bool has_pending_exception; |
2459 Object** argv[] = { result.location() }; | 2459 Handle<Object> argv[] = { result }; |
2460 Handle<Object> desc = | 2460 Handle<Object> desc = |
2461 Execution::Call(isolate->to_complete_property_descriptor(), result, | 2461 Execution::Call(isolate->to_complete_property_descriptor(), result, |
2462 ARRAY_SIZE(argv), argv, &has_pending_exception); | 2462 ARRAY_SIZE(argv), argv, &has_pending_exception); |
2463 if (has_pending_exception) return Failure::Exception(); | 2463 if (has_pending_exception) return Failure::Exception(); |
2464 | 2464 |
2465 Handle<String> conf_name = | 2465 Handle<String> conf_name = |
2466 isolate->factory()->LookupAsciiSymbol("configurable_"); | 2466 isolate->factory()->LookupAsciiSymbol("configurable_"); |
2467 Handle<Object> configurable(v8::internal::GetProperty(desc, conf_name)); | 2467 Handle<Object> configurable(v8::internal::GetProperty(desc, conf_name)); |
2468 ASSERT(!isolate->has_pending_exception()); | 2468 ASSERT(!isolate->has_pending_exception()); |
2469 if (configurable->IsFalse()) { | 2469 if (configurable->IsFalse()) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 Handle<Object> name(name_raw); | 2551 Handle<Object> name(name_raw); |
2552 | 2552 |
2553 Handle<Object> args[] = { name }; | 2553 Handle<Object> args[] = { name }; |
2554 Handle<Object> result = CallTrap( | 2554 Handle<Object> result = CallTrap( |
2555 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); | 2555 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); |
2556 if (isolate->has_pending_exception()) return NONE; | 2556 if (isolate->has_pending_exception()) return NONE; |
2557 | 2557 |
2558 if (result->IsUndefined()) return ABSENT; | 2558 if (result->IsUndefined()) return ABSENT; |
2559 | 2559 |
2560 bool has_pending_exception; | 2560 bool has_pending_exception; |
2561 Object** argv[] = { result.location() }; | 2561 Handle<Object> argv[] = { result }; |
2562 Handle<Object> desc = | 2562 Handle<Object> desc = |
2563 Execution::Call(isolate->to_complete_property_descriptor(), result, | 2563 Execution::Call(isolate->to_complete_property_descriptor(), result, |
2564 ARRAY_SIZE(argv), argv, &has_pending_exception); | 2564 ARRAY_SIZE(argv), argv, &has_pending_exception); |
2565 if (has_pending_exception) return NONE; | 2565 if (has_pending_exception) return NONE; |
2566 | 2566 |
2567 // Convert result to PropertyAttributes. | 2567 // Convert result to PropertyAttributes. |
2568 Handle<String> enum_n = isolate->factory()->LookupAsciiSymbol("enumerable"); | 2568 Handle<String> enum_n = isolate->factory()->LookupAsciiSymbol("enumerable"); |
2569 Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n)); | 2569 Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n)); |
2570 if (isolate->has_pending_exception()) return NONE; | 2570 if (isolate->has_pending_exception()) return NONE; |
2571 Handle<String> conf_n = isolate->factory()->LookupAsciiSymbol("configurable"); | 2571 Handle<String> conf_n = isolate->factory()->LookupAsciiSymbol("configurable"); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 | 2619 |
2620 // Inherit identity, if it was present. | 2620 // Inherit identity, if it was present. |
2621 Object* hash; | 2621 Object* hash; |
2622 if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { | 2622 if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { |
2623 Handle<JSObject> new_self(JSObject::cast(*self)); | 2623 Handle<JSObject> new_self(JSObject::cast(*self)); |
2624 isolate->factory()->SetIdentityHash(new_self, hash); | 2624 isolate->factory()->SetIdentityHash(new_self, hash); |
2625 } | 2625 } |
2626 } | 2626 } |
2627 | 2627 |
2628 | 2628 |
2629 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap( | 2629 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, |
2630 const char* name, | 2630 Handle<Object> derived, |
2631 Handle<Object> derived, | 2631 int argc, |
2632 int argc, | 2632 Handle<Object> argv[]) { |
2633 Handle<Object> args[]) { | |
2634 Isolate* isolate = GetIsolate(); | 2633 Isolate* isolate = GetIsolate(); |
2635 Handle<Object> handler(this->handler()); | 2634 Handle<Object> handler(this->handler()); |
2636 | 2635 |
2637 Handle<String> trap_name = isolate->factory()->LookupAsciiSymbol(name); | 2636 Handle<String> trap_name = isolate->factory()->LookupAsciiSymbol(name); |
2638 Handle<Object> trap(v8::internal::GetProperty(handler, trap_name)); | 2637 Handle<Object> trap(v8::internal::GetProperty(handler, trap_name)); |
2639 if (isolate->has_pending_exception()) return trap; | 2638 if (isolate->has_pending_exception()) return trap; |
2640 | 2639 |
2641 if (trap->IsUndefined()) { | 2640 if (trap->IsUndefined()) { |
2642 if (derived.is_null()) { | 2641 if (derived.is_null()) { |
2643 Handle<Object> args[] = { handler, trap_name }; | 2642 Handle<Object> args[] = { handler, trap_name }; |
2644 Handle<Object> error = isolate->factory()->NewTypeError( | 2643 Handle<Object> error = isolate->factory()->NewTypeError( |
2645 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); | 2644 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); |
2646 isolate->Throw(*error); | 2645 isolate->Throw(*error); |
2647 return Handle<Object>(); | 2646 return Handle<Object>(); |
2648 } | 2647 } |
2649 trap = Handle<Object>(derived); | 2648 trap = Handle<Object>(derived); |
2650 } | 2649 } |
2651 | 2650 |
2652 Object*** argv = reinterpret_cast<Object***>(args); | |
2653 bool threw; | 2651 bool threw; |
2654 return Execution::Call(trap, handler, argc, argv, &threw); | 2652 return Execution::Call(trap, handler, argc, argv, &threw); |
2655 } | 2653 } |
2656 | 2654 |
2657 | 2655 |
2658 MaybeObject* JSObject::SetPropertyForResult(LookupResult* result, | 2656 MaybeObject* JSObject::SetPropertyForResult(LookupResult* result, |
2659 String* name, | 2657 String* name, |
2660 Object* value, | 2658 Object* value, |
2661 PropertyAttributes attributes, | 2659 PropertyAttributes attributes, |
2662 StrictModeFlag strict_mode) { | 2660 StrictModeFlag strict_mode) { |
(...skipping 9509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12172 if (break_point_objects()->IsUndefined()) return 0; | 12170 if (break_point_objects()->IsUndefined()) return 0; |
12173 // Single break point. | 12171 // Single break point. |
12174 if (!break_point_objects()->IsFixedArray()) return 1; | 12172 if (!break_point_objects()->IsFixedArray()) return 1; |
12175 // Multiple break points. | 12173 // Multiple break points. |
12176 return FixedArray::cast(break_point_objects())->length(); | 12174 return FixedArray::cast(break_point_objects())->length(); |
12177 } | 12175 } |
12178 #endif | 12176 #endif |
12179 | 12177 |
12180 | 12178 |
12181 } } // namespace v8::internal | 12179 } } // namespace v8::internal |
OLD | NEW |