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

Side by Side Diff: src/contexts.h

Issue 10837358: Throw a more descriptive exception when blocking 'eval' via CSP. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add SetErrorMessageForCodeGenerationFromStrings API function. Created 8 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/api.cc ('k') | src/contexts.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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ 147 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \
148 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \ 148 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \
149 call_as_constructor_delegate) \ 149 call_as_constructor_delegate) \
150 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ 150 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \
151 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ 151 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \
152 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \ 152 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \
153 V(OUT_OF_MEMORY_INDEX, Object, out_of_memory) \ 153 V(OUT_OF_MEMORY_INDEX, Object, out_of_memory) \
154 V(MAP_CACHE_INDEX, Object, map_cache) \ 154 V(MAP_CACHE_INDEX, Object, map_cache) \
155 V(CONTEXT_DATA_INDEX, Object, data) \ 155 V(CONTEXT_DATA_INDEX, Object, data) \
156 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \ 156 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \
157 V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \
158 error_message_for_code_gen_from_strings) \
157 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \ 159 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \
158 to_complete_property_descriptor) \ 160 to_complete_property_descriptor) \
159 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \ 161 V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \
160 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \ 162 V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \
161 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \ 163 V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \
162 V(PROXY_ENUMERATE, JSFunction, proxy_enumerate) \ 164 V(PROXY_ENUMERATE, JSFunction, proxy_enumerate) \
163 V(RANDOM_SEED_INDEX, ByteArray, random_seed) 165 V(RANDOM_SEED_INDEX, ByteArray, random_seed)
164 166
165 // JSFunctions are pairs (context, function code), sometimes also called 167 // JSFunctions are pairs (context, function code), sometimes also called
166 // closures. A Context object is used to represent function contexts and 168 // closures. A Context object is used to represent function contexts and
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 NORMALIZED_MAP_CACHE_INDEX, 276 NORMALIZED_MAP_CACHE_INDEX,
275 RUNTIME_CONTEXT_INDEX, 277 RUNTIME_CONTEXT_INDEX,
276 CALL_AS_FUNCTION_DELEGATE_INDEX, 278 CALL_AS_FUNCTION_DELEGATE_INDEX,
277 CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, 279 CALL_AS_CONSTRUCTOR_DELEGATE_INDEX,
278 SCRIPT_FUNCTION_INDEX, 280 SCRIPT_FUNCTION_INDEX,
279 OPAQUE_REFERENCE_FUNCTION_INDEX, 281 OPAQUE_REFERENCE_FUNCTION_INDEX,
280 CONTEXT_EXTENSION_FUNCTION_INDEX, 282 CONTEXT_EXTENSION_FUNCTION_INDEX,
281 OUT_OF_MEMORY_INDEX, 283 OUT_OF_MEMORY_INDEX,
282 CONTEXT_DATA_INDEX, 284 CONTEXT_DATA_INDEX,
283 ALLOW_CODE_GEN_FROM_STRINGS_INDEX, 285 ALLOW_CODE_GEN_FROM_STRINGS_INDEX,
286 ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX,
284 TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, 287 TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX,
285 DERIVED_HAS_TRAP_INDEX, 288 DERIVED_HAS_TRAP_INDEX,
286 DERIVED_GET_TRAP_INDEX, 289 DERIVED_GET_TRAP_INDEX,
287 DERIVED_SET_TRAP_INDEX, 290 DERIVED_SET_TRAP_INDEX,
288 PROXY_ENUMERATE, 291 PROXY_ENUMERATE,
289 RANDOM_SEED_INDEX, 292 RANDOM_SEED_INDEX,
290 293
291 // Properties from here are treated as weak references by the full GC. 294 // Properties from here are treated as weak references by the full GC.
292 // Scavenge treats them as strong references. 295 // Scavenge treats them as strong references.
293 OPTIMIZED_FUNCTIONS_LIST, // Weak. 296 OPTIMIZED_FUNCTIONS_LIST, // Weak.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 377
375 // Mark the native context with out of memory. 378 // Mark the native context with out of memory.
376 inline void mark_out_of_memory(); 379 inline void mark_out_of_memory();
377 380
378 // A native context hold a list of all functions which have been optimized. 381 // A native context hold a list of all functions which have been optimized.
379 void AddOptimizedFunction(JSFunction* function); 382 void AddOptimizedFunction(JSFunction* function);
380 void RemoveOptimizedFunction(JSFunction* function); 383 void RemoveOptimizedFunction(JSFunction* function);
381 Object* OptimizedFunctionsListHead(); 384 Object* OptimizedFunctionsListHead();
382 void ClearOptimizedFunctions(); 385 void ClearOptimizedFunctions();
383 386
387 Handle<Object> ErrorMessageForCodeGenerationFromStrings();
388
384 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ 389 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
385 void set_##name(type* value) { \ 390 void set_##name(type* value) { \
386 ASSERT(IsNativeContext()); \ 391 ASSERT(IsNativeContext()); \
387 set(index, value); \ 392 set(index, value); \
388 } \ 393 } \
389 type* name() { \ 394 type* name() { \
390 ASSERT(IsNativeContext()); \ 395 ASSERT(IsNativeContext()); \
391 return type::cast(get(index)); \ 396 return type::cast(get(index)); \
392 } 397 }
393 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS) 398 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 #ifdef DEBUG 444 #ifdef DEBUG
440 // Bootstrapping-aware type checks. 445 // Bootstrapping-aware type checks.
441 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); 446 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid);
442 static bool IsBootstrappingOrGlobalObject(Object* object); 447 static bool IsBootstrappingOrGlobalObject(Object* object);
443 #endif 448 #endif
444 }; 449 };
445 450
446 } } // namespace v8::internal 451 } } // namespace v8::internal
447 452
448 #endif // V8_CONTEXTS_H_ 453 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698