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

Side by Side Diff: src/runtime.cc

Issue 9600013: Use an enum for indicating the component of an AccessorPair instead of a boolean flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | 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 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 // There are 3 cases that lead here: 4311 // There are 3 cases that lead here:
4312 // Step 4b - define a new accessor property. 4312 // Step 4b - define a new accessor property.
4313 // Steps 9c & 12 - replace an existing data property with an accessor property. 4313 // Steps 9c & 12 - replace an existing data property with an accessor property.
4314 // Step 12 - update an existing accessor property with an accessor or generic 4314 // Step 12 - update an existing accessor property with an accessor or generic
4315 // descriptor. 4315 // descriptor.
4316 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) { 4316 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) {
4317 ASSERT(args.length() == 5); 4317 ASSERT(args.length() == 5);
4318 HandleScope scope(isolate); 4318 HandleScope scope(isolate);
4319 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 4319 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
4320 CONVERT_ARG_CHECKED(String, name, 1); 4320 CONVERT_ARG_CHECKED(String, name, 1);
4321 CONVERT_SMI_ARG_CHECKED(flag_setter, 2); 4321 CONVERT_SMI_ARG_CHECKED(flag, 2);
4322 Object* fun = args[3]; 4322 Object* fun = args[3];
4323 CONVERT_SMI_ARG_CHECKED(unchecked, 4); 4323 CONVERT_SMI_ARG_CHECKED(unchecked, 4);
4324 4324
4325 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); 4325 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
4326 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); 4326 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
4327 4327
4328 RUNTIME_ASSERT(!obj->IsNull()); 4328 RUNTIME_ASSERT(!obj->IsNull());
4329 RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); 4329 RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined());
4330 return obj->DefineAccessor(name, flag_setter == 0, fun, attr); 4330 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER;
4331 return obj->DefineAccessor(name, component, fun, attr);
4331 } 4332 }
4332 4333
4333 // Implements part of 8.12.9 DefineOwnProperty. 4334 // Implements part of 8.12.9 DefineOwnProperty.
4334 // There are 3 cases that lead here: 4335 // There are 3 cases that lead here:
4335 // Step 4a - define a new data property. 4336 // Step 4a - define a new data property.
4336 // Steps 9b & 12 - replace an existing accessor property with a data property. 4337 // Steps 9b & 12 - replace an existing accessor property with a data property.
4337 // Step 12 - update an existing data property with a data or generic 4338 // Step 12 - update an existing data property with a data or generic
4338 // descriptor. 4339 // descriptor.
4339 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) { 4340 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
4340 ASSERT(args.length() == 4); 4341 ASSERT(args.length() == 4);
(...skipping 5944 matching lines...) Expand 10 before | Expand all | Expand 10 after
10285 return *isolate->factory()->NewJSArrayWithElements(single_interval); 10286 return *isolate->factory()->NewJSArrayWithElements(single_interval);
10286 } 10287 }
10287 } 10288 }
10288 10289
10289 10290
10290 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { 10291 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) {
10291 ASSERT(args.length() == 3); 10292 ASSERT(args.length() == 3);
10292 CONVERT_ARG_CHECKED(JSObject, obj, 0); 10293 CONVERT_ARG_CHECKED(JSObject, obj, 0);
10293 CONVERT_ARG_CHECKED(String, name, 1); 10294 CONVERT_ARG_CHECKED(String, name, 1);
10294 CONVERT_SMI_ARG_CHECKED(flag, 2); 10295 CONVERT_SMI_ARG_CHECKED(flag, 2);
10295 return obj->LookupAccessor(name, flag == 0); 10296 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER;
10297 return obj->LookupAccessor(name, component);
10296 } 10298 }
10297 10299
10298 10300
10299 #ifdef ENABLE_DEBUGGER_SUPPORT 10301 #ifdef ENABLE_DEBUGGER_SUPPORT
10300 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) { 10302 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) {
10301 ASSERT(args.length() == 0); 10303 ASSERT(args.length() == 0);
10302 return Execution::DebugBreakHelper(); 10304 return Execution::DebugBreakHelper();
10303 } 10305 }
10304 10306
10305 10307
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
13621 // Handle last resort GC and make sure to allow future allocations 13623 // Handle last resort GC and make sure to allow future allocations
13622 // to grow the heap without causing GCs (if possible). 13624 // to grow the heap without causing GCs (if possible).
13623 isolate->counters()->gc_last_resort_from_js()->Increment(); 13625 isolate->counters()->gc_last_resort_from_js()->Increment();
13624 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13626 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13625 "Runtime::PerformGC"); 13627 "Runtime::PerformGC");
13626 } 13628 }
13627 } 13629 }
13628 13630
13629 13631
13630 } } // namespace v8::internal 13632 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698