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

Side by Side Diff: src/accessors.cc

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 years, 10 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 | « include/v8.h ('k') | src/api.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 97
98 MaybeObject* Accessors::ArraySetLength(JSObject* object, Object* value, void*) { 98 MaybeObject* Accessors::ArraySetLength(JSObject* object, Object* value, void*) {
99 Isolate* isolate = object->GetIsolate(); 99 Isolate* isolate = object->GetIsolate();
100 100
101 // This means one of the object's prototypes is a JSArray and the 101 // This means one of the object's prototypes is a JSArray and the
102 // object does not have a 'length' property. Calling SetProperty 102 // object does not have a 'length' property. Calling SetProperty
103 // causes an infinite loop. 103 // causes an infinite loop.
104 if (!object->IsJSArray()) { 104 if (!object->IsJSArray()) {
105 return object->SetLocalPropertyIgnoreAttributes( 105 return object->SetLocalPropertyIgnoreAttributes(
106 isolate->heap()->length_symbol(), value, NONE); 106 isolate->heap()->length_string(), value, NONE);
107 } 107 }
108 108
109 value = FlattenNumber(value); 109 value = FlattenNumber(value);
110 110
111 // Need to call methods that may trigger GC. 111 // Need to call methods that may trigger GC.
112 HandleScope scope(isolate); 112 HandleScope scope(isolate);
113 113
114 // Protect raw pointers. 114 // Protect raw pointers.
115 Handle<JSArray> array_handle(JSArray::cast(object), isolate); 115 Handle<JSArray> array_handle(JSArray::cast(object), isolate);
116 Handle<Object> value_handle(value, isolate); 116 Handle<Object> value_handle(value, isolate);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, 467 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object,
468 Object* value_raw, 468 Object* value_raw,
469 void*) { 469 void*) {
470 Isolate* isolate = object->GetIsolate(); 470 Isolate* isolate = object->GetIsolate();
471 Heap* heap = isolate->heap(); 471 Heap* heap = isolate->heap();
472 JSFunction* function_raw = FindInstanceOf<JSFunction>(object); 472 JSFunction* function_raw = FindInstanceOf<JSFunction>(object);
473 if (function_raw == NULL) return heap->undefined_value(); 473 if (function_raw == NULL) return heap->undefined_value();
474 if (!function_raw->should_have_prototype()) { 474 if (!function_raw->should_have_prototype()) {
475 // Since we hit this accessor, object will have no prototype property. 475 // Since we hit this accessor, object will have no prototype property.
476 return object->SetLocalPropertyIgnoreAttributes(heap->prototype_symbol(), 476 return object->SetLocalPropertyIgnoreAttributes(heap->prototype_string(),
477 value_raw, 477 value_raw,
478 NONE); 478 NONE);
479 } 479 }
480 480
481 HandleScope scope(isolate); 481 HandleScope scope(isolate);
482 Handle<JSFunction> function(function_raw, isolate); 482 Handle<JSFunction> function(function_raw, isolate);
483 Handle<Object> value(value_raw, isolate); 483 Handle<Object> value(value_raw, isolate);
484 484
485 Handle<Object> old_value; 485 Handle<Object> old_value;
486 bool is_observed = 486 bool is_observed =
487 FLAG_harmony_observation && 487 FLAG_harmony_observation &&
488 *function == object && 488 *function == object &&
489 function->map()->is_observed(); 489 function->map()->is_observed();
490 if (is_observed) { 490 if (is_observed) {
491 if (function->has_prototype()) 491 if (function->has_prototype())
492 old_value = handle(function->prototype(), isolate); 492 old_value = handle(function->prototype(), isolate);
493 else 493 else
494 old_value = isolate->factory()->NewFunctionPrototype(function); 494 old_value = isolate->factory()->NewFunctionPrototype(function);
495 } 495 }
496 496
497 Handle<Object> result; 497 Handle<Object> result;
498 MaybeObject* maybe_result = function->SetPrototype(*value); 498 MaybeObject* maybe_result = function->SetPrototype(*value);
499 if (!maybe_result->ToHandle(&result, isolate)) return maybe_result; 499 if (!maybe_result->ToHandle(&result, isolate)) return maybe_result;
500 ASSERT(function->prototype() == *value); 500 ASSERT(function->prototype() == *value);
501 501
502 if (is_observed && !old_value->SameValue(*value)) { 502 if (is_observed && !old_value->SameValue(*value)) {
503 JSObject::EnqueueChangeRecord( 503 JSObject::EnqueueChangeRecord(
504 function, "updated", isolate->factory()->prototype_symbol(), old_value); 504 function, "updated", isolate->factory()->prototype_string(), old_value);
505 } 505 }
506 506
507 return *function; 507 return *function;
508 } 508 }
509 509
510 510
511 const AccessorDescriptor Accessors::FunctionPrototype = { 511 const AccessorDescriptor Accessors::FunctionPrototype = {
512 FunctionGetPrototype, 512 FunctionGetPrototype,
513 FunctionSetPrototype, 513 FunctionSetPrototype,
514 0 514 0
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // correct number of arguments and no allocated arguments object, so 616 // correct number of arguments and no allocated arguments object, so
617 // we can construct a fresh one by interpreting the function's 617 // we can construct a fresh one by interpreting the function's
618 // deoptimization input data. 618 // deoptimization input data.
619 return ConstructArgumentsObjectForInlinedFunction(frame, function, i); 619 return ConstructArgumentsObjectForInlinedFunction(frame, function, i);
620 } 620 }
621 621
622 if (!frame->is_optimized()) { 622 if (!frame->is_optimized()) {
623 // If there is an arguments variable in the stack, we return that. 623 // If there is an arguments variable in the stack, we return that.
624 Handle<ScopeInfo> scope_info(function->shared()->scope_info()); 624 Handle<ScopeInfo> scope_info(function->shared()->scope_info());
625 int index = scope_info->StackSlotIndex( 625 int index = scope_info->StackSlotIndex(
626 isolate->heap()->arguments_symbol()); 626 isolate->heap()->arguments_string());
627 if (index >= 0) { 627 if (index >= 0) {
628 Handle<Object> arguments(frame->GetExpression(index), isolate); 628 Handle<Object> arguments(frame->GetExpression(index), isolate);
629 if (!arguments->IsArgumentsMarker()) return *arguments; 629 if (!arguments->IsArgumentsMarker()) return *arguments;
630 } 630 }
631 } 631 }
632 632
633 // If there is no arguments variable in the stack or we have an 633 // If there is no arguments variable in the stack or we have an
634 // optimized frame, we find the frame that holds the actual arguments 634 // optimized frame, we find the frame that holds the actual arguments
635 // passed to the function. 635 // passed to the function.
636 it.AdvanceToArgumentsFrame(); 636 it.AdvanceToArgumentsFrame();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 Handle<Object> value(value_raw); 809 Handle<Object> value(value_raw);
810 Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver)); 810 Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(*receiver));
811 811
812 MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes); 812 MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes);
813 Handle<Object> hresult; 813 Handle<Object> hresult;
814 if (!result->ToHandle(&hresult, isolate)) return result; 814 if (!result->ToHandle(&hresult, isolate)) return result;
815 815
816 Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver)); 816 Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(*receiver));
817 if (!new_value->SameValue(*old_value)) { 817 if (!new_value->SameValue(*old_value)) {
818 JSObject::EnqueueChangeRecord(receiver, "prototype", 818 JSObject::EnqueueChangeRecord(receiver, "prototype",
819 isolate->factory()->Proto_symbol(), 819 isolate->factory()->proto_string(),
820 old_value); 820 old_value);
821 } 821 }
822 return *hresult; 822 return *hresult;
823 } 823 }
824 824
825 825
826 const AccessorDescriptor Accessors::ObjectPrototype = { 826 const AccessorDescriptor Accessors::ObjectPrototype = {
827 ObjectGetPrototype, 827 ObjectGetPrototype,
828 ObjectSetPrototype, 828 ObjectSetPrototype,
829 0 829 0
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 info->set_data(Smi::FromInt(index)); 888 info->set_data(Smi::FromInt(index));
889 Handle<Object> getter = v8::FromCData(&ModuleGetExport); 889 Handle<Object> getter = v8::FromCData(&ModuleGetExport);
890 Handle<Object> setter = v8::FromCData(&ModuleSetExport); 890 Handle<Object> setter = v8::FromCData(&ModuleSetExport);
891 info->set_getter(*getter); 891 info->set_getter(*getter);
892 if (!(attributes & ReadOnly)) info->set_setter(*setter); 892 if (!(attributes & ReadOnly)) info->set_setter(*setter);
893 return info; 893 return info;
894 } 894 }
895 895
896 896
897 } } // namespace v8::internal 897 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698