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

Side by Side Diff: src/accessors.cc

Issue 960343002: ES6: Make function name configurable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Relax assert Created 5 years, 9 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
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | src/lookup.cc » ('J')
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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/contexts.h" 9 #include "src/contexts.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder())); 1128 Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
1129 Handle<Object> result(function->shared()->name(), isolate); 1129 Handle<Object> result(function->shared()->name(), isolate);
1130 info.GetReturnValue().Set(Utils::ToLocal(result)); 1130 info.GetReturnValue().Set(Utils::ToLocal(result));
1131 } 1131 }
1132 1132
1133 1133
1134 void Accessors::FunctionNameSetter( 1134 void Accessors::FunctionNameSetter(
1135 v8::Local<v8::Name> name, 1135 v8::Local<v8::Name> name,
1136 v8::Local<v8::Value> val, 1136 v8::Local<v8::Value> val,
1137 const v8::PropertyCallbackInfo<void>& info) { 1137 const v8::PropertyCallbackInfo<void>& info) {
1138 // Function name is non writable, non configurable. 1138 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
1139 UNREACHABLE(); 1139 HandleScope scope(isolate);
1140 Handle<Object> value = Utils::OpenHandle(*val);
1141
1142 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
1143
1144 Handle<JSObject> object = Utils::OpenHandle(*info.This());
1145 LookupIterator it(object, Utils::OpenHandle(*name));
1146 CHECK_EQ(LookupIterator::ACCESSOR, it.state());
1147 DCHECK(it.HolderIsReceiverOrHiddenPrototype());
1148 it.PrepareForDataProperty(value);
1149 if (Object::SetDataProperty(&it, value).is_null()) {
1150 isolate->OptionalRescheduleException(false);
1151 }
adamk 2015/02/26 23:31:51 You're going to want an EnqueueChangeRecord call h
Toon Verwaest 2015/02/27 12:44:10 Unlike Function::SetPrototype, SetDataProperty alr
1140 } 1152 }
1141 1153
1142 1154
1143 Handle<AccessorInfo> Accessors::FunctionNameInfo( 1155 Handle<AccessorInfo> Accessors::FunctionNameInfo(
1144 Isolate* isolate, PropertyAttributes attributes) { 1156 Isolate* isolate, PropertyAttributes attributes) {
1145 return MakeAccessor(isolate, 1157 return MakeAccessor(isolate,
1146 isolate->factory()->name_string(), 1158 isolate->factory()->name_string(),
1147 &FunctionNameGetter, 1159 &FunctionNameGetter,
1148 &FunctionNameSetter, 1160 &FunctionNameSetter,
1149 attributes); 1161 attributes);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 info->set_data(Smi::FromInt(index)); 1509 info->set_data(Smi::FromInt(index));
1498 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1510 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1499 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1511 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1500 info->set_getter(*getter); 1512 info->set_getter(*getter);
1501 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1513 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1502 return info; 1514 return info;
1503 } 1515 }
1504 1516
1505 1517
1506 } } // namespace v8::internal 1518 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | src/lookup.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698