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

Side by Side Diff: src/accessors.cc

Issue 24093002: Use trampoline or handlified JSObject::SetLocalPropertyIgnoreAttributes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 years, 3 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 | src/heap.cc » ('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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 107
108 MaybeObject* Accessors::ArraySetLength(Isolate* isolate, 108 MaybeObject* Accessors::ArraySetLength(Isolate* isolate,
109 JSObject* object, 109 JSObject* object,
110 Object* value, 110 Object* value,
111 void*) { 111 void*) {
112 // This means one of the object's prototypes is a JSArray and the 112 // This means one of the object's prototypes is a JSArray and the
113 // object does not have a 'length' property. Calling SetProperty 113 // object does not have a 'length' property. Calling SetProperty
114 // causes an infinite loop. 114 // causes an infinite loop.
115 if (!object->IsJSArray()) { 115 if (!object->IsJSArray()) {
116 return object->SetLocalPropertyIgnoreAttributes( 116 return object->SetLocalPropertyIgnoreAttributesTrampoline(
117 isolate->heap()->length_string(), value, NONE); 117 isolate->heap()->length_string(), value, NONE);
118 } 118 }
119 119
120 value = FlattenNumber(isolate, value); 120 value = FlattenNumber(isolate, value);
121 121
122 // Need to call methods that may trigger GC. 122 // Need to call methods that may trigger GC.
123 HandleScope scope(isolate); 123 HandleScope scope(isolate);
124 124
125 // Protect raw pointers. 125 // Protect raw pointers.
126 Handle<JSArray> array_handle(JSArray::cast(object), isolate); 126 Handle<JSArray> array_handle(JSArray::cast(object), isolate);
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 MaybeObject* Accessors::FunctionSetPrototype(Isolate* isolate, 525 MaybeObject* Accessors::FunctionSetPrototype(Isolate* isolate,
526 JSObject* object, 526 JSObject* object,
527 Object* value_raw, 527 Object* value_raw,
528 void*) { 528 void*) {
529 Heap* heap = isolate->heap(); 529 Heap* heap = isolate->heap();
530 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, object); 530 JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, object);
531 if (function_raw == NULL) return heap->undefined_value(); 531 if (function_raw == NULL) return heap->undefined_value();
532 if (!function_raw->should_have_prototype()) { 532 if (!function_raw->should_have_prototype()) {
533 // Since we hit this accessor, object will have no prototype property. 533 // Since we hit this accessor, object will have no prototype property.
534 return object->SetLocalPropertyIgnoreAttributes(heap->prototype_string(), 534 return object->SetLocalPropertyIgnoreAttributesTrampoline(
535 value_raw, 535 heap->prototype_string(), value_raw, NONE);
536 NONE);
537 } 536 }
538 537
539 HandleScope scope(isolate); 538 HandleScope scope(isolate);
540 Handle<JSFunction> function(function_raw, isolate); 539 Handle<JSFunction> function(function_raw, isolate);
541 Handle<Object> value(value_raw, isolate); 540 Handle<Object> value(value_raw, isolate);
542 541
543 Handle<Object> old_value; 542 Handle<Object> old_value;
544 bool is_observed = 543 bool is_observed =
545 FLAG_harmony_observation && 544 FLAG_harmony_observation &&
546 *function == object && 545 *function == object &&
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 info->set_data(Smi::FromInt(index)); 907 info->set_data(Smi::FromInt(index));
909 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 908 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
910 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 909 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
911 info->set_getter(*getter); 910 info->set_getter(*getter);
912 if (!(attributes & ReadOnly)) info->set_setter(*setter); 911 if (!(attributes & ReadOnly)) info->set_setter(*setter);
913 return info; 912 return info;
914 } 913 }
915 914
916 915
917 } } // namespace v8::internal 916 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698