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 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2189 if (result->IsFound() && result->type() == HANDLER) { | 2189 if (result->IsFound() && result->type() == HANDLER) { |
2190 return JSProxy::cast(this)->SetPropertyWithHandler( | 2190 return JSProxy::cast(this)->SetPropertyWithHandler( |
2191 key, value, attributes, strict_mode); | 2191 key, value, attributes, strict_mode); |
2192 } else { | 2192 } else { |
2193 return JSObject::cast(this)->SetPropertyForResult( | 2193 return JSObject::cast(this)->SetPropertyForResult( |
2194 result, key, value, attributes, strict_mode); | 2194 result, key, value, attributes, strict_mode); |
2195 } | 2195 } |
2196 } | 2196 } |
2197 | 2197 |
2198 | 2198 |
2199 bool JSProxy::HasPropertyWithHandler(String* name_raw) { | |
2200 Isolate* isolate = GetIsolate(); | |
2201 HandleScope scope(isolate); | |
2202 Handle<Object> receiver(this); | |
2203 Handle<Object> name(name_raw); | |
2204 Handle<Object> handler(this->handler()); | |
2205 | |
2206 // Extract trap function. | |
2207 Handle<String> trap_name = isolate->factory()->LookupAsciiSymbol("has"); | |
2208 Handle<Object> trap(v8::internal::GetProperty(handler, trap_name)); | |
Mads Ager (chromium)
2011/07/19 09:35:28
I would use = instead of constructor syntax here.
| |
2209 if (trap->IsUndefined()) { | |
2210 trap = isolate->derived_has_trap(); | |
2211 } | |
2212 | |
2213 // Call trap function. | |
2214 Object** args[] = { name.location() }; | |
2215 bool has_exception; | |
2216 Handle<Object> result = | |
2217 Execution::Call(trap, handler, ARRAY_SIZE(args), args, &has_exception); | |
2218 if (has_exception) return Failure::Exception(); | |
2219 | |
2220 return result->ToBoolean()->IsTrue(); | |
2221 } | |
2222 | |
2223 | |
2199 MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyWithHandler( | 2224 MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyWithHandler( |
2200 String* name_raw, | 2225 String* name_raw, |
2201 Object* value_raw, | 2226 Object* value_raw, |
2202 PropertyAttributes attributes, | 2227 PropertyAttributes attributes, |
2203 StrictModeFlag strict_mode) { | 2228 StrictModeFlag strict_mode) { |
2204 Isolate* isolate = GetIsolate(); | 2229 Isolate* isolate = GetIsolate(); |
2205 HandleScope scope(isolate); | 2230 HandleScope scope(isolate); |
2206 Handle<Object> receiver(this); | 2231 Handle<Object> receiver(this); |
2207 Handle<Object> name(name_raw); | 2232 Handle<Object> name(name_raw); |
2208 Handle<Object> value(value_raw); | 2233 Handle<Object> value(value_raw); |
(...skipping 9555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11764 if (break_point_objects()->IsUndefined()) return 0; | 11789 if (break_point_objects()->IsUndefined()) return 0; |
11765 // Single beak point. | 11790 // Single beak point. |
11766 if (!break_point_objects()->IsFixedArray()) return 1; | 11791 if (!break_point_objects()->IsFixedArray()) return 1; |
11767 // Multiple break points. | 11792 // Multiple break points. |
11768 return FixedArray::cast(break_point_objects())->length(); | 11793 return FixedArray::cast(break_point_objects())->length(); |
11769 } | 11794 } |
11770 #endif | 11795 #endif |
11771 | 11796 |
11772 | 11797 |
11773 } } // namespace v8::internal | 11798 } } // namespace v8::internal |
OLD | NEW |