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

Side by Side Diff: src/v8natives.js

Issue 7774008: Port r9018 and r9030 to the 3.4 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.4
Patch Set: Update version too. Created 9 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 | « src/accessors.cc ('k') | src/version.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 // 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 341
342 function IsInconsistentDescriptor(desc) { 342 function IsInconsistentDescriptor(desc) {
343 return IsAccessorDescriptor(desc) && IsDataDescriptor(desc); 343 return IsAccessorDescriptor(desc) && IsDataDescriptor(desc);
344 } 344 }
345 345
346 346
347 // ES5 8.10.4 347 // ES5 8.10.4
348 function FromPropertyDescriptor(desc) { 348 function FromPropertyDescriptor(desc) {
349 if (IS_UNDEFINED(desc)) return desc; 349 if (IS_UNDEFINED(desc)) return desc;
350 var obj = new $Object(); 350
351 if (IsDataDescriptor(desc)) { 351 if (IsDataDescriptor(desc)) {
352 obj.value = desc.getValue(); 352 return { value: desc.getValue(),
353 obj.writable = desc.isWritable(); 353 writable: desc.isWritable(),
354 enumerable: desc.isEnumerable(),
355 configurable: desc.isConfigurable() };
354 } 356 }
355 if (IsAccessorDescriptor(desc)) { 357 // Must be an AccessorDescriptor then. We never return a generic descriptor.
356 obj.get = desc.getGet(); 358 return { get: desc.getGet(),
357 obj.set = desc.getSet(); 359 set: desc.getSet(),
358 } 360 enumerable: desc.isEnumerable(),
359 obj.enumerable = desc.isEnumerable(); 361 configurable: desc.isConfigurable() };
360 obj.configurable = desc.isConfigurable();
361 return obj;
362 } 362 }
363 363
364
364 // Harmony Proxies 365 // Harmony Proxies
365 function FromGenericPropertyDescriptor(desc) { 366 function FromGenericPropertyDescriptor(desc) {
366 if (IS_UNDEFINED(desc)) return desc; 367 if (IS_UNDEFINED(desc)) return desc;
367 var obj = new $Object(); 368 var obj = new $Object();
368 if (desc.hasValue()) obj.value = desc.getValue(); 369
369 if (desc.hasWritable()) obj.writable = desc.isWritable(); 370 if (desc.hasValue()) {
370 if (desc.hasGetter()) obj.get = desc.getGet(); 371 %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
371 if (desc.hasSetter()) obj.set = desc.getSet(); 372 }
372 if (desc.hasEnumerable()) obj.enumerable = desc.isEnumerable(); 373 if (desc.hasWritable()) {
373 if (desc.hasConfigurable()) obj.configurable = desc.isConfigurable(); 374 %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
375 }
376 if (desc.hasGetter()) {
377 %IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
378 }
379 if (desc.hasSetter()) {
380 %IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
381 }
382 if (desc.hasEnumerable()) {
383 %IgnoreAttributesAndSetProperty(obj, "enumerable",
384 desc.isEnumerable(), NONE);
385 }
386 if (desc.hasConfigurable()) {
387 %IgnoreAttributesAndSetProperty(obj, "configurable",
388 desc.isConfigurable(), NONE);
389 }
374 return obj; 390 return obj;
375 } 391 }
376 392
393
377 // ES5 8.10.5. 394 // ES5 8.10.5.
378 function ToPropertyDescriptor(obj) { 395 function ToPropertyDescriptor(obj) {
379 if (!IS_SPEC_OBJECT(obj)) { 396 if (!IS_SPEC_OBJECT(obj)) {
380 throw MakeTypeError("property_desc_object", [obj]); 397 throw MakeTypeError("property_desc_object", [obj]);
381 } 398 }
382 var desc = new PropertyDescriptor(); 399 var desc = new PropertyDescriptor();
383 400
384 if ("enumerable" in obj) { 401 if ("enumerable" in obj) {
385 desc.setEnumerable(ToBoolean(obj.enumerable)); 402 desc.setEnumerable(ToBoolean(obj.enumerable));
386 } 403 }
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 // ---------------------------------------------------------------------------- 1500 // ----------------------------------------------------------------------------
1484 1501
1485 function SetupFunction() { 1502 function SetupFunction() {
1486 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1503 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1487 "bind", FunctionBind, 1504 "bind", FunctionBind,
1488 "toString", FunctionToString 1505 "toString", FunctionToString
1489 )); 1506 ));
1490 } 1507 }
1491 1508
1492 SetupFunction(); 1509 SetupFunction();
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698