Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: src/objects.cc

Issue 8133023: Use correct trap for lookup in prototype proxy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 LookupCallbackSetterInPrototypes(name, &accessor_result); 2022 LookupCallbackSetterInPrototypes(name, &accessor_result);
2023 if (accessor_result.IsFound()) { 2023 if (accessor_result.IsFound()) {
2024 if (accessor_result.type() == CALLBACKS) { 2024 if (accessor_result.type() == CALLBACKS) {
2025 return SetPropertyWithCallback(accessor_result.GetCallbackObject(), 2025 return SetPropertyWithCallback(accessor_result.GetCallbackObject(),
2026 name, 2026 name,
2027 value, 2027 value,
2028 accessor_result.holder(), 2028 accessor_result.holder(),
2029 strict_mode); 2029 strict_mode);
2030 } else if (accessor_result.type() == HANDLER) { 2030 } else if (accessor_result.type() == HANDLER) {
2031 // There is a proxy in the prototype chain. Invoke its 2031 // There is a proxy in the prototype chain. Invoke its
2032 // getOwnPropertyDescriptor trap. 2032 // getPropertyDescriptor trap.
2033 bool found = false; 2033 bool found = false;
2034 // SetPropertyWithHandlerIfDefiningSetter can cause GC, 2034 // SetPropertyWithHandlerIfDefiningSetter can cause GC,
2035 // make sure to use the handlified references after calling 2035 // make sure to use the handlified references after calling
2036 // the function. 2036 // the function.
2037 Handle<JSObject> self(this); 2037 Handle<JSObject> self(this);
2038 Handle<String> hname(name); 2038 Handle<String> hname(name);
2039 Handle<Object> hvalue(value); 2039 Handle<Object> hvalue(value);
2040 MaybeObject* result = 2040 MaybeObject* result =
2041 accessor_result.proxy()->SetPropertyWithHandlerIfDefiningSetter( 2041 accessor_result.proxy()->SetPropertyWithHandlerIfDefiningSetter(
2042 name, value, attributes, strict_mode, &found); 2042 name, value, attributes, strict_mode, &found);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 PropertyAttributes attributes, 2441 PropertyAttributes attributes,
2442 StrictModeFlag strict_mode, 2442 StrictModeFlag strict_mode,
2443 bool* found) { 2443 bool* found) {
2444 *found = true; // except where defined otherwise... 2444 *found = true; // except where defined otherwise...
2445 Isolate* isolate = GetHeap()->isolate(); 2445 Isolate* isolate = GetHeap()->isolate();
2446 Handle<JSProxy> proxy(this); 2446 Handle<JSProxy> proxy(this);
2447 Handle<String> name(name_raw); 2447 Handle<String> name(name_raw);
2448 Handle<Object> value(value_raw); 2448 Handle<Object> value(value_raw);
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 "getPropertyDescriptor", 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 Object** argv[] = { result.location() };
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,
(...skipping 9718 matching lines...) Expand 10 before | Expand all | Expand 10 after
12180 if (break_point_objects()->IsUndefined()) return 0; 12180 if (break_point_objects()->IsUndefined()) return 0;
12181 // Single break point. 12181 // Single break point.
12182 if (!break_point_objects()->IsFixedArray()) return 1; 12182 if (!break_point_objects()->IsFixedArray()) return 1;
12183 // Multiple break points. 12183 // Multiple break points.
12184 return FixedArray::cast(break_point_objects())->length(); 12184 return FixedArray::cast(break_point_objects())->length();
12185 } 12185 }
12186 #endif 12186 #endif
12187 12187
12188 12188
12189 } } // namespace v8::internal 12189 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698