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

Side by Side Diff: src/property-descriptor.cc

Issue 2028983002: Introduce IsUndefined(Isolate*) and IsTheHole(Isolate*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase master Created 4 years, 6 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 | « src/profiler/heap-snapshot-generator.cc ('k') | src/runtime/runtime-array.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/property-descriptor.h" 5 #include "src/property-descriptor.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/lookup.h" 10 #include "src/lookup.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // getter? 242 // getter?
243 Handle<Object> getter; 243 Handle<Object> getter;
244 // 16 through 18b. 244 // 16 through 18b.
245 if (!GetPropertyIfPresent(receiver, isolate->factory()->get_string(), 245 if (!GetPropertyIfPresent(receiver, isolate->factory()->get_string(),
246 &getter)) { 246 &getter)) {
247 return false; 247 return false;
248 } 248 }
249 if (!getter.is_null()) { 249 if (!getter.is_null()) {
250 // 18c. If IsCallable(getter) is false and getter is not undefined, 250 // 18c. If IsCallable(getter) is false and getter is not undefined,
251 // throw a TypeError exception. 251 // throw a TypeError exception.
252 if (!getter->IsCallable() && !getter->IsUndefined()) { 252 if (!getter->IsCallable() && !getter->IsUndefined(isolate)) {
253 isolate->Throw(*isolate->factory()->NewTypeError( 253 isolate->Throw(*isolate->factory()->NewTypeError(
254 MessageTemplate::kObjectGetterCallable, getter)); 254 MessageTemplate::kObjectGetterCallable, getter));
255 return false; 255 return false;
256 } 256 }
257 // 18d. Set the [[Get]] field of desc to getter. 257 // 18d. Set the [[Get]] field of desc to getter.
258 desc->set_get(getter); 258 desc->set_get(getter);
259 } 259 }
260 // setter? 260 // setter?
261 Handle<Object> setter; 261 Handle<Object> setter;
262 // 19 through 21b. 262 // 19 through 21b.
263 if (!GetPropertyIfPresent(receiver, isolate->factory()->set_string(), 263 if (!GetPropertyIfPresent(receiver, isolate->factory()->set_string(),
264 &setter)) { 264 &setter)) {
265 return false; 265 return false;
266 } 266 }
267 if (!setter.is_null()) { 267 if (!setter.is_null()) {
268 // 21c. If IsCallable(setter) is false and setter is not undefined, 268 // 21c. If IsCallable(setter) is false and setter is not undefined,
269 // throw a TypeError exception. 269 // throw a TypeError exception.
270 if (!setter->IsCallable() && !setter->IsUndefined()) { 270 if (!setter->IsCallable() && !setter->IsUndefined(isolate)) {
271 isolate->Throw(*isolate->factory()->NewTypeError( 271 isolate->Throw(*isolate->factory()->NewTypeError(
272 MessageTemplate::kObjectSetterCallable, setter)); 272 MessageTemplate::kObjectSetterCallable, setter));
273 return false; 273 return false;
274 } 274 }
275 // 21d. Set the [[Set]] field of desc to setter. 275 // 21d. Set the [[Set]] field of desc to setter.
276 desc->set_set(setter); 276 desc->set_set(setter);
277 } 277 }
278 278
279 // 22. If either desc.[[Get]] or desc.[[Set]] is present, then 279 // 22. If either desc.[[Get]] or desc.[[Set]] is present, then
280 // 22a. If either desc.[[Value]] or desc.[[Writable]] is present, 280 // 22a. If either desc.[[Value]] or desc.[[Writable]] is present,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Desc.[[Enumerable]] to like.[[Enumerable]]. 329 // Desc.[[Enumerable]] to like.[[Enumerable]].
330 if (!desc->has_enumerable()) desc->set_enumerable(false); 330 if (!desc->has_enumerable()) desc->set_enumerable(false);
331 // 7. If Desc does not have a [[Configurable]] field, set 331 // 7. If Desc does not have a [[Configurable]] field, set
332 // Desc.[[Configurable]] to like.[[Configurable]]. 332 // Desc.[[Configurable]] to like.[[Configurable]].
333 if (!desc->has_configurable()) desc->set_configurable(false); 333 if (!desc->has_configurable()) desc->set_configurable(false);
334 // 8. Return Desc. 334 // 8. Return Desc.
335 } 335 }
336 336
337 } // namespace internal 337 } // namespace internal
338 } // namespace v8 338 } // namespace v8
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698